本文整理汇总了TypeScript中lodash.flatten函数的典型用法代码示例。如果您正苦于以下问题:TypeScript flatten函数的具体用法?TypeScript flatten怎么用?TypeScript flatten使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flatten函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const topicPhrases = topics.map((topic: TopicCollection) => _.flatten(topic.actions.map(action => action.phrases)));
示例2: flatten
.then(result => flatten(result));
示例3: expandHistory
export function expandHistory(lexemes: string[]): string[] {
return _.flatten(lexemes.map(lexeme => historyReplacement(lexeme)));
}
示例4: test
test('each chunk has the correct slice size', t => {
let allLengths = _.flatten(_.map(chunks, chunk => _.map(chunk, 'length')));
t.deepEqual(allLengths, _.fill(Array(12), 4));
});
示例5: loadModules
loadModules(locations: string[]) {
let activities = _.flatten(locations.map(this.loadLocation.bind(this))) as T[]
for (let activity of activities) {
this.registry[activity.getHandlerName()] = activity
}
}
示例6: return
return () => curryDefinition(definition, _.flatten(args), spreadIndex, isFixed);
示例7: expect
cacheInitializer.refreshCache('credentials').then((result: any[]) => {
expect(flatten(result)).toEqual(keys.account);
cache = infrastructureCache.get('credentials');
expect(cache.keys().length).toBe(0);
});
示例8: getMonikers
public getMonikers(applications: Application[], filter: IServerGroupFilter = defaultFilter): IMoniker[] {
const allMonikers: IMoniker[][] = applications.map(a => a.getDataSource('serverGroups').data
.filter(filter)
.map((serverGroup: IServerGroup) => serverGroup.moniker));
return compact(flatten(allMonikers));
}
示例9: getClusters
public getClusters(applications: Application[], filter: IServerGroupFilter = defaultFilter): string[] {
const allClusters: string[][] = applications.map(a => a.getDataSource('serverGroups').data
.filter(filter)
.map((serverGroup: IServerGroup) => serverGroup.cluster));
return uniq(compact(flatten(allClusters))).sort();
}
示例10: flatten
export const getColorDefinition = (hex: string, theme: GrafanaTheme): ColorDefinition | undefined => {
return flatten(Array.from(getNamedColorPalette().values())).filter(definition => definition.variants[theme] === hex)[0];
};