当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript md5类代码示例

本文整理汇总了TypeScript中md5的典型用法代码示例。如果您正苦于以下问题:TypeScript md5类的具体用法?TypeScript md5怎么用?TypeScript md5使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了md5类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: ensureNoPrevExec

	function ensureNoPrevExec(code: string): string {
		return `(() => {
			if (window['${md5(code)}'] === true) {
				return;
			}
			window['${md5(code)}'] = true;
			
			${code}
		})()`;
	}
开发者ID:SanderRonde,项目名称:youtube-music-app,代码行数:10,代码来源:util.ts

示例2: md5

 const objs = contents.map((content, index) => ({
   objectID: index ? md5(`${href}${index}`) : md5(href),
   fileName,
   repo: repoName,
   categories: file
     .split('/')
     .filter(
       c => Number.isNaN(parseInt(c, 10)) && c.indexOf('.md') === -1
     ),
   href,
   desc,
   content
 }));
开发者ID:wxyyxc1992,项目名称:ConfigurableAPIServer,代码行数:13,代码来源:buildDocIndex.ts

示例3: checkPasswordMd5

 static async checkPasswordMd5() {
   console.log('  checkPasswordMd5')
   const users = await User.findAll()
   if (users.length === 0 || isMd5(users[0].password)) {
     console.log('  users empty or md5 check passed')
     return
   }
   for (const user of users) {
     if (!isMd5(user.password)) {
       user.password = md5(md5(user.password))
       await user.save()
       console.log(`handle user ${user.id}`)
     }
   }
 }
开发者ID:tonyjt,项目名称:rap2-delos,代码行数:15,代码来源:migrate.ts

示例4: getPreviewClippingNamespace

export const getComponentScreenshot = (componentId: string, previewName: string, state: ApplicationState) => {
  const ss = state.componentScreenshots[state.componentScreenshots.length - 1];
  const clippingNamespace = getPreviewClippingNamespace(componentId, previewName);
  return ss && ss.clippings[clippingNamespace] && {
    previewName,
    uri: `http://localhost:${state.options.port}/screenshots/${md5(state.componentScreenshots[state.componentScreenshots.length - 1].uri)}`,
    clip: ss.clippings[clippingNamespace]
  };
};
开发者ID:cryptobuks,项目名称:tandem,代码行数:9,代码来源:index.ts

示例5: getIndex

function* getIndex(req: Request, res: Response) {
  let state: ExtensionState = yield select();

  if (!state.childDevServerInfo) {
    yield put(startDevServerRequest());
    yield take(CHILD_DEV_SERVER_STARTED);
    state = yield select();
  }

  const { getEntryHTML } = require(getTandemDirectory(state));

  res.send(getEntryHTML({
    apiHost: `http://localhost:${state.childDevServerInfo.port}`,
    textEditorHost: `http://localhost:${state.port}`,
    storageNamespace: md5(state.rootPath),
    filePrefix: "/tandem"
  }));
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:18,代码来源:api.ts

示例6: getGeneratedMetricHash

function getGeneratedMetricHash(title: string, format: string, expression: string) {
    return md5(`${expression}#${title}#${format}`);
}
开发者ID:gooddata,项目名称:gooddata-js,代码行数:3,代码来源:experimental-executions.ts

示例7: md5

export const getEmailHash = (email: string) => {
  return email && md5(email.trim().toLowerCase());
}
开发者ID:displague,项目名称:manager,代码行数:3,代码来源:gravatar.ts

示例8: grapherUrlToFilekey

export function grapherUrlToFilekey(grapherUrl: string) {
    const url = parseUrl(grapherUrl)
    const slug = _.last(url.pathname.split('/')) as string
    const queryStr = url.query as any
    return `${slug}${queryStr ? "-"+md5(queryStr) : ""}`
}
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:6,代码来源:grapherUtil.ts

示例9: md5

 return state.componentScreenshots.find((screenshot) => md5(screenshot.uri) === req.params.screenshotHash);
开发者ID:cryptobuks,项目名称:tandem,代码行数:1,代码来源:api.ts

示例10: buildLinkIndex

export async function buildLinkIndex(client) {
  const index = client.initIndex('link');

  // 设置相关性

  index.setSettings({
    searchableAttributes: ['title', 'fileName', 'categories', 'desc', 'href'],
    attributesForFaceting: ['year', 'type', 'categories']
  });

  const repoName = 'Awesome-Lists';

  // 获取仓库的配置信息
  const repo: ReposityConfig = repos[repoName];

  const files = walkSync(repo.localPath).filter(
    path =>
      path.endsWith('.md') &&
      path.indexOf('README') === -1 &&
      path.indexOf('ABOUT') === -1 &&
      path.indexOf('Weekly') === -1
  );

  // 待提交到 Algo 的对象
  let pendingObjs = [];

  for (let file of files) {
    // 封装出文件链接
    const fileHref = `${repo.sUrl}/blob/master/${file}`;
    const absoluteFile = `${repo.localPath}/${file}`;
    let fileName: string = file.split('/').reverse()[0];

    // 读取文件内容
    const content = await readFileAsync(absoluteFile, { encoding: 'utf-8' });

    if (!content) {
      continue;
    }

    let match;

    while ((match = LinkRegex.exec(content))) {
      const [raw, rawTitle, href, desc] = match;

      // 这里进行过滤,过滤掉 URL 重复的部分
      if (!href || bloom.has(href)) {
        continue;
      }

      const { year, title, type } = extractInfoFromTitle(rawTitle);

      bloom.add(href);
      count++;

      const obj: LinkItem = {
        objectID: md5(href),
        title,
        href,
        desc: desc ? desc.replace(':', '').trim() : '',
        raw,

        year,
        type,

        fileName: fileName.split('.')[0],
        fileHref,
        categories: file
          .split('/')
          .filter(c => Number.isNaN(parseInt(c, 10)) && c.indexOf('.md') === -1)
      };

      pendingObjs.push(obj);

      if (pendingObjs.length >= BatchNum) {
        try {
          await index.addObjects(pendingObjs);
          pendingObjs = [];
        } catch (e) {
          console.error(e);
        }
      }
    }

    // 提交剩余的
    if (pendingObjs.length > 0) {
      try {
        await index.addObjects(pendingObjs);
        pendingObjs = [];
      } catch (e) {
        console.error(e);
      }
    }
  }

  console.log(`${repoName} indexed finally. ${count} links`);
}
开发者ID:wxyyxc1992,项目名称:ConfigurableAPIServer,代码行数:96,代码来源:buildLinkIndex.ts


注:本文中的md5类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。