本文整理汇总了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;未经允许,请勿转载。 |
请发表评论