本文整理匯總了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];
};