本文整理汇总了TypeScript中underscore.uniq函数的典型用法代码示例。如果您正苦于以下问题:TypeScript uniq函数的具体用法?TypeScript uniq怎么用?TypeScript uniq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uniq函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: buildModules
function buildModules(modules:any[]) {
var result:any[] = [];
_.each(modules, (value:any, key:string) => {
result.push({
name: key,
type: 'toggle',
classes: _.map(value.classes, (c:any) => {
return {
name: c.name,
url: '/' + key + '/classes/' + c.name,
type: 'link'
};
}),
interfaces: _.map(value.interfaces, (c:any) => {
return {
name: c.name,
url: '/' + key + '/interfaces/' + c.name,
type: 'link'
};
}),
enumerations: _.map(value.enumerations, (c:any) => {
return {
name: c.name,
url: '/' + key + '/enumerations/' + c.name,
type: 'link'
};
})
})
});
return _.uniq(result);
}
开发者ID:justindujardin,项目名称:pow2,代码行数:31,代码来源:docs.ts
示例2: work
async work(): Promise<void> {
const installLocationId = this.space().firstPathElement();
let call = withLogger(this.logger);
const { caves, installLocationPath, installLocationSize } = await call(
messages.FetchCavesByInstallLocationID,
{ installLocationId }
);
let games: Game[] = [];
if (!isEmpty(caves)) {
for (const c of caves) {
games.push(c.game);
}
games = uniq(games, g => g.id);
}
this.pushUnfilteredGames(games, { disableFilters: true });
this.push({
location: {
path: installLocationPath,
size: installLocationSize,
},
});
}
开发者ID:HorrerGames,项目名称:itch,代码行数:26,代码来源:location-fetcher.ts
示例3: normalizeQueryString
private static normalizeQueryString(toNormalize: IUrlNormalize) {
let queryNormalized: string[] = [];
if (toNormalize.queryAsString) {
const cleanedUp = this.toArray(toNormalize.queryAsString).map(query => {
query = this.removeProblematicChars(query);
query = this.encodeKeyValuePair(query);
return query;
});
queryNormalized = queryNormalized.concat(cleanedUp);
}
if (toNormalize.query) {
const paired: string[][] = pairs(toNormalize.query);
const mapped = paired.map(pair => {
const [key, value] = pair;
if (Utils.isNullOrUndefined(value) || Utils.isNullOrUndefined(key)) {
return '';
}
if (!this.isEncoded(value)) {
return [this.removeProblematicChars(key), Utils.safeEncodeURIComponent(value)].join('=');
} else {
return [this.removeProblematicChars(key), value].join('=');
}
});
queryNormalized = queryNormalized.concat(mapped);
}
return uniq(queryNormalized);
}
开发者ID:francoislg,项目名称:search-ui,代码行数:32,代码来源:UrlUtils.ts
示例4: filterItems
_.each(dimVendorService.vendors, (vendor: any) => {
const vendItems = filterItems(
_.select(
vendor.allItems.map((i) => i.item),
(item) =>
item.bucket.sort === 'Armor' || item.type === 'Artifact' || item.type === 'Ghost'
)
);
vendorItems = vendorItems.concat(vendItems);
// Exclude felwinters if we have them
const felwinters = vendorItems.filter((i) => i.hash === 2672107540);
if (felwinters.length) {
vm.excludeditems.push(...felwinters);
vm.excludeditems = _.uniq(vm.excludeditems, 'id');
}
// Build a map of perks
_.each(vendItems, (item) => {
if (item.classType === 3) {
_.each(['warlock', 'titan', 'hunter'], (classType) => {
vendorPerks[classType][item.type] = filterPerks(
vendorPerks[classType][item.type],
item
);
});
} else {
vendorPerks[item.classTypeName][item.type] = filterPerks(
vendorPerks[item.classTypeName][item.type],
item
);
}
});
});
开发者ID:bhollis,项目名称:DIM,代码行数:34,代码来源:loadout-builder.component.ts
示例5: getMaxTransactionDepth
function getMaxTransactionDepth(sindex:SindexShortEntry[]) {
const ids = _.uniq(_.pluck(sindex, 'tx'))
let maxTxChainingDepth = 0
for (let id of ids) {
maxTxChainingDepth = Math.max(maxTxChainingDepth, getTransactionDepth(id, sindex, 0))
}
return maxTxChainingDepth
}
开发者ID:duniter,项目名称:duniter,代码行数:8,代码来源:local_rules.ts
示例6: async
checkCertificationUnicity: async (block:BlockDTO, conf:ConfDTO, index:IndexEntry[]) => {
const cindex = Indexer.cindex(index);
const certAtoB = _.uniq(cindex.map((row:CindexEntry) => row.issuer + row.receiver));
if (certAtoB.length !== cindex.length) {
throw Error('Block cannot contain identical certifications (A -> B)');
}
return true;
},
开发者ID:duniter,项目名称:duniter,代码行数:8,代码来源:local_rules.ts
示例7: getTagsFromState
getTagsFromState(state:ITodoState) {
let tags:string[] = _.flatten(state.todos.map(todo => todo.tags));
let nonBlank = tags.filter(t => !!t);
let sorted = _.sortBy(nonBlank);
let unique = _.uniq(sorted, true);
return unique;
}
开发者ID:allash,项目名称:angular2-seed-example-mashup,代码行数:8,代码来源:TodoService.ts
示例8: shouldCalcTimeAxisLabels
shouldCalcTimeAxisLabels(labels: string[], span: number): boolean {
return (
(
span > this.SECOND && this.axisType === "time"
|| this.axisType === "nanotime" && plotUtils.gt(span, this.UNIT)
)
&& labels.length != _.uniq(labels).length
);
}
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:9,代码来源:TimeAxis.ts
注:本文中的underscore.uniq函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论