本文整理汇总了TypeScript中Immutable.List.groupBy方法的典型用法代码示例。如果您正苦于以下问题:TypeScript List.groupBy方法的具体用法?TypeScript List.groupBy怎么用?TypeScript List.groupBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Immutable.List
的用法示例。
在下文中一共展示了List.groupBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createDeployGroupRecord
const createDeployGroup = (deploys: List<DeployRecord>) => (
deploys.groupBy(deploy => (
createDeployGroupRecord({
status: deploy.status,
build: deploy.build
})
))
);
示例2: h
(
[ codeDeploys, prodDeploys ]: [ List<DeployRecord>, List<DeployRecord> ],
[ latestCodeDeploy, oldestProdDeploy ]: [ DeployRecord, DeployRecord ],
commits: List<GitHubCommit>
): VirtualDOM.VNode => {
const isInSync = oldestProdDeploy.build === latestCodeDeploy.build;
return h('.row#root', {}, [
h('h1', [
`Status: ${isInSync ? 'in sync. Ship it!' : 'out of sync.'}`
]),
h('hr', {}, []),
exp(commits.size > 0) && h('.col', [
h('h1', [
'Difference (',
h('span', { title: 'Oldest PROD deploy' }, `${oldestProdDeploy.build}`),
'...',
h('span', { title: 'Latest CODE deploy' }, `${latestCodeDeploy.build}`),
')'
]),
ih('ul', {}, (
commits
.groupBy(commit => commit.authorLogin)
.map(commits => headOption(commits.toArray()).map(commit => commit.authorName).getOrElse(() => ''))
.map(commitAuthorName => (
h('li', [
h('h2', commitAuthorName)
])
))
.toList()
))
]),
h('.col', [
h('h1', 'CODE'),
renderGroupDeployListNode(codeDeploys)
]),
h('.col', [
h('h1', 'PROD'),
renderGroupDeployListNode(prodDeploys)
])
])
}