當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ramda.indexBy函數代碼示例

本文整理匯總了TypeScript中ramda.indexBy函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript indexBy函數的具體用法?TypeScript indexBy怎麽用?TypeScript indexBy使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了indexBy函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: parseRegions

function parseRegions(fileContent: string): RegionMap {
  const questionRows: Row[] = parse(fileContent);
  const regions = questionRows.slice(1).map(row => ({
    id: row[0],
    name: row[1]
  }));
  return R.indexBy(r => r.id, regions) as RegionMap;
}
開發者ID:shybyte,項目名稱:wahlomat,代碼行數:8,代碼來源:convert.ts

示例2:

export const pageDTO = (page: Page): PageDTO => {
  const translations = R.map(
    R.prop('value'),
    R.indexBy(R.prop('field'), page.translations),
  );

  return {
    alias: page.alias,
    title: translations.title,
    content: translations.content,
  }
}
開發者ID:apuchenkin,項目名稱:aws.photo.service,代碼行數:12,代碼來源:page.ts

示例3: getDataFields

    return getDataFields(address).then(fields => {
        const oracle = getProviderData(fields);
        if (oracle.status === RESPONSE_STATUSES.ERROR) {
            return null;
        }

        const assets = getProviderAssets(fields)
            .filter(item => item.status === RESPONSE_STATUSES.OK)
            .map(item => item.content) as Array<TProviderAsset>;

        return {
            oracle: oracle.content,
            assets: indexBy<TProviderAsset>(prop('id'), assets)
        };
    });
開發者ID:wavesplatform,項目名稱:WavesGUI,代碼行數:15,代碼來源:index.ts

示例4:

export const categoryDTO = (category: Category): CategoryDTO => {
  const translations = R.map(
    R.prop('value'),
    R.indexBy(R.prop('field'), category.translations),
  );
  const children = category.children || [];

  return {
    name: category.name,
    date: category.date,
    title: translations.title,
    featured: category.featured && category.featured.src,
    description: translations.description,
    children: children.map(categoryDTO),
  }
}
開發者ID:apuchenkin,項目名稱:aws.photo.service,代碼行數:16,代碼來源:category.ts

示例5:

export const photoDTO = (photo: Photo): PhotoDTO => {
  const translations = R.map(
    R.prop('value'),
    R.indexBy(R.prop('field'), photo.translations),
  );

  return {
    src: photo.src,
    views: photo.views,
    width: photo.width,
    height: photo.height,
    group: photo.group,
    datetime: photo.datetime,
    description: translations.description,
  }
}
開發者ID:apuchenkin,項目名稱:aws.photo.service,代碼行數:16,代碼來源:photo.ts

示例6:

export const cardListFrom = (array: Array<Card>): CardContainer =>
  R.indexBy<Card>(R.prop('id'), array);
開發者ID:zernie,項目名稱:typescript-redux-card-game,代碼行數:2,代碼來源:Card.ts

示例7:

export const entitiesFrom = (array: Array<Character>): EntityContainer =>
  R.indexBy<Character>(R.prop('id'), array);
開發者ID:zernie,項目名稱:typescript-redux-card-game,代碼行數:2,代碼來源:Board.ts


注:本文中的ramda.indexBy函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。