本文整理汇总了TypeScript中lodash.values函数的典型用法代码示例。如果您正苦于以下问题:TypeScript values函数的具体用法?TypeScript values怎么用?TypeScript values使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了values函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('sorting', () => {
let orderedStatuses = _.values(STATUS_TYPES).sort();
it('should support sorting ascending', () => {
tablePageObject.statusColumn.sortAscending();
expect(tablePageObject.getStatuses()).to.eventually.eql(orderedStatuses);
});
it('should support sorting descending', () => {
tablePageObject.statusColumn.sortDescending();
expect(tablePageObject.getStatuses()).to.eventually.eql(orderedStatuses.reverse());
});
});
示例2: uniqueGenomicLocations
export function uniqueGenomicLocations(mutations: Mutation[]): GenomicLocation[]
{
const genomicLocationMap: {[key: string]: GenomicLocation} = {};
mutations.map((mutation: Mutation) => {
const genomicLocation: GenomicLocation|undefined = extractGenomicLocation(mutation);
if (genomicLocation) {
genomicLocationMap[genomicLocationString(genomicLocation)] = genomicLocation;
}
});
return _.values(genomicLocationMap);
}
示例3: transform
transform(bundle: { [bundleVersion: string]: PropertyQuery } ): { title: string; fields: string[]; expanded?: boolean; }[] {
// Get a nested array of EndpointQueries
const arr: EndpointQuery[][] = values(bundle).map((propertyQuery: PropertyQuery) => propertyQuery.endpoints);
// Reformat for easy parsing in the template
return flatten(arr).map((endpointQuery: EndpointQuery) => {
return {
title: endpointQuery.endpoint.replace('/', ' '),
fields: endpointQuery.mapping ?
uniqBy(Object.keys(endpointQuery.mapping), path => path.split('.')[0]).map(name => name.replace(/_/g, ' '))
: ['NONE']
};
});
}
示例4: paivitaSivunavi
function paivitaSivunavi() {
var navi = {
oppiaineet: []
};
_.forEach(_.values(oppiaineet), function(oa) {
navi.oppiaineet.push(oa);
});
_.each($scope.navi.sections[2].model.sections, function(v) {
if (navi[v.id]) {
v.items = navi[v.id];
}
});
}
示例5: startCron
startCron(opts, cb) {
opts = opts || {};
this.providers = _.values(require('./fiatrateproviders'));
const interval = opts.fetchInterval || Defaults.FIAT_RATE_FETCH_INTERVAL;
if (interval) {
this._fetch();
setInterval(() => {
this._fetch();
}, interval * 60 * 1000);
}
return cb();
}
示例6: BlockChainExplorer
(done) => {
this.explorers = {
btc: {},
bch: {}
};
const coinNetworkPairs = [];
_.each(_.values(Constants.COINS), (coin) => {
_.each(_.values(Constants.NETWORKS), (network) => {
coinNetworkPairs.push({
coin,
network
});
});
});
_.each(coinNetworkPairs, (pair) => {
let explorer;
if (
opts.blockchainExplorers &&
opts.blockchainExplorers[pair.coin] &&
opts.blockchainExplorers[pair.coin][pair.network]
) {
explorer = opts.blockchainExplorers[pair.coin][pair.network];
} else {
let config: { url?: string; provider?: any } = {};
if (
opts.blockchainExplorerOpts &&
opts.blockchainExplorerOpts[pair.coin] &&
opts.blockchainExplorerOpts[pair.coin][pair.network]
) {
config = opts.blockchainExplorerOpts[pair.coin][pair.network];
} else {
return;
}
explorer = BlockChainExplorer({
provider: config.provider,
coin: pair.coin,
network: pair.network,
url: config.url,
userAgent: WalletService.getServiceVersion()
});
}
$.checkState(explorer);
this._initExplorer(pair.coin, pair.network, explorer);
this.explorers[pair.coin][pair.network] = explorer;
});
done();
},
示例7: getDuplicateModules
export function getDuplicateModules(classes: VenueLesson[]): ModuleCode[] {
const lessonsByTime: VenueLesson[][] = values(
groupBy(classes, (lesson) => [lesson.startTime, lesson.endTime, lesson.weeks, lesson.day]),
);
for (const lessons of lessonsByTime) {
if (lessons.length > 1) {
// Occasionally two classes share the same venue, so we don't count those
const moduleCodes = uniq(lessons.map((lesson) => lesson.moduleCode));
if (uniq(moduleCodes).length > 1) return moduleCodes;
}
}
return [];
}
示例8: aggregateStatementStats
export function aggregateStatementStats(statementStats: CollectedStatementStatistics[]) {
const statementsMap: { [statement: string]: CollectedStatementStatistics[] } = {};
statementStats.forEach(
(statement: CollectedStatementStatistics) => {
const matches = statementsMap[statement.key.key_data.query] || (statementsMap[statement.key.key_data.query] = []);
matches.push(statement);
});
return _.values(statementsMap).map(statements =>
_.reduce(statements, (a: CollectedStatementStatistics, b: CollectedStatementStatistics) => ({
key: a.key,
stats: addStatementStats(a.stats, b.stats),
})),
);
}
示例9: createAndSendQuery
createAndSendQuery(silent) {
// Create a query with all the current filters
let query = _.values(_.mapValues(this.fields, function(value) { return value.query; })).join(' AND ');
// Update the query parameter
if (!silent) {
this.$state.transitionTo(
this.$state.current,
_.merge(this.$state.params, {
q: query
}),
{notify: false});
this.onFilterChange({query: query, widget: this.lastSource});
}
}
示例10:
calculated: (entityUsage) => {
let count_values = _.uniq(entityUsage.map(e => e.total_count));
let barResults = {};
let results = entityUsage.forEach(entity => {
barResults[entity.entityType] = barResults[entity.entityType] || { entityType: entity.entityType };
barResults[entity.entityType][entity.total_count] = entity.entity_count;
});
return {
"entities-usage": _.values(barResults),
"entities-usage-bars": count_values
};
}