當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。