本文整理汇总了TypeScript中underscore.values函数的典型用法代码示例。如果您正苦于以下问题:TypeScript values函数的具体用法?TypeScript values怎么用?TypeScript values使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了values函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: attempt
public attempt(context: ReplyContext) {
const normalizedText = context.sourceMessage.text.toLowerCase()
const shortCommands = _.sortBy(_.values(Looker.customCommands), (c) => -c.name.length)
const matchedCommand = shortCommands.filter((c) => normalizedText.indexOf(c.name) === 0)[0]
if (matchedCommand) {
const { dashboard } = matchedCommand
const query = context.sourceMessage.text.slice(matchedCommand.name.length).trim()
normalizedText.indexOf(matchedCommand.name)
context.looker = matchedCommand.looker
const filters: {[key: string]: string} = {}
const dashboardFilters = dashboard.dashboard_filters || dashboard.filters
for (const filter of dashboardFilters) {
filters[filter.name] = query
}
const runner = new DashboardQueryRunner(context, matchedCommand.dashboard, filters)
runner.start()
return true
} else {
return false
}
}
开发者ID:DipJar,项目名称:looker-slackbot,代码行数:25,代码来源:custom_command.ts
示例2: constructor
constructor(opts: DaoOptions<T>) {
this.tablename = opts.tablename;
this.columnsMapping = opts.columnsMapping;
this.objectconstructor = opts.objectconstructor;
this.columnsMappingLength = _.keys(this.columnsMapping).length;
this.columnsMappingKeys = _.keys(this.columnsMapping);
this.columnsMappingValues = _.values(this.columnsMapping);
this.primarykey = opts.primarykey;
// Generate insert query string
this.insertQuery = "INSERT INTO " + this.tablename + " (";
let includeLength = 0;
let args: any[] = [];
let i = 0;
while (i < this.columnsMappingLength - 1) {
this.insertQuery += this.columnsMappingValues[i] + ", ";
i++;
}
this.insertQuery += this.columnsMappingValues[i];
this.insertQuery += ") values(";
i = 0;
while (i < this.columnsMappingLength - 1) {
this.insertQuery += "?, ";
i++;
}
this.insertQuery += "?);";
}
开发者ID:JohanBaskovec,项目名称:libraryBackEnd,代码行数:28,代码来源:GoodORM.ts
示例3: reduceBy
function reduceBy(reducables: any[], properties: string[]) {
const reduced = reducables.reduce((map, entry) => {
const id = properties.map((prop) => entry[prop]).join('-');
map[id] = map[id] || [];
map[id].push(entry);
return map;
}, {});
return _.values(reduced).map((rows: any[]) => reduce(rows))
}
开发者ID:Kalmac,项目名称:duniter,代码行数:9,代码来源:IndexedBlockchain.ts
示例4: constructor
constructor(opts: DaoOptions<T>) {
this.tablename = opts.tablename;
this.columnsMapping = opts.columnsMapping;
this.objectconstructor = opts.objectconstructor;
this.columnsMappingLength = _.keys(this.columnsMapping).length;
this.columnsMappingKeys = _.keys(this.columnsMapping);
this.columnsMappingValues = _.values(this.columnsMapping);
this.primarykey = opts.primarykey;
}
开发者ID:JohanBaskovec,项目名称:nodejslibrary,代码行数:9,代码来源:GoodORM.ts
示例5: async
onConfiguredExecute: async (server:any, conf:ConfDTO, program:any, params:any, wizardTasks:any) => {
const step = params[0];
const tasks = step ? [wizardTasks[step]] : _.values(wizardTasks);
for (const task of tasks) {
if (!task) {
throw 'Unknown task';
}
await task(conf, program)
}
// Check config
await server.checkConfig();
await server.dal.saveConf(conf);
logger.debug("Configuration saved.");
}
开发者ID:Kalmac,项目名称:duniter,代码行数:14,代码来源:wizard.ts
示例6: constructor
constructor(options:ParseTemplate) {
this._keys = _.keys(options.template.props);
this._mappings = _.values(options.template.props);
this._name = options.name;
this._props = options.template.props;
// set document context
if (options.template.context) {
if (_.isString(options.template.context)) {
this._documentSelector = options.template.context;
} else {
this._documentSelector = options.template.context.selector;
this._documentSelectorIndex = options.template.context.index;
}
} else {
throw new Error('Missing template context');
}
}
开发者ID:molekilla,项目名称:menio,代码行数:19,代码来源:menio.ts
示例7: dump
function dump(mode: "E" | "D", args1: [any?, ...any[]]) {
const a2 = _.values(args1) as [string, ...string[]];
const output = format.apply(null, a2);
let a1 = [buildPrefix(mode)];
let i = 0;
for (const line of output.split("\n")) {
const lineArguments = ([] as string[]).concat(a1, [line]) as [string, ...string[]];
console.log.apply(console, lineArguments);
a1 = [continuation];
i = i + 1;
if (i > maxLines) {
const a3 = a1.concat([" .... TRUNCATED ....."]);
console.log.apply(console, a3 as [string, ...string[]]);
break;
}
}
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:20,代码来源:make_loggers.ts
示例8: constructNamespaceDependency
function constructNamespaceDependency(
namespace: NamespacePrivate
) {
const addressSpace = namespace.addressSpace;
// navigate all namespace recursively to
// find dependency
const dependency = [];
const depMap = new Set();
// default namespace is always first
dependency.push(addressSpace.getDefaultNamespace());
depMap.add(dependency[0].index);
if (namespace !== addressSpace.getDefaultNamespace()) {
dependency.push(namespace);
depMap.add(namespace.index);
}
for (const node of _.values(namespace._nodeid_index)) {
// visit all reference
const references = node.ownReferences();
for (const reference of references) {
// check referenceId
const namespaceIndex = reference._referenceType!.nodeId.namespace;
if (!depMap.has(namespaceIndex)) {
depMap.add(namespaceIndex);
dependency.push(addressSpace.getNamespace(namespaceIndex));
}
const namespaceIndex2 = reference.nodeId.namespace;
if (!depMap.has(namespaceIndex2)) {
depMap.add(namespaceIndex2);
dependency.push(addressSpace.getNamespace(namespaceIndex2));
}
}
}
return dependency;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:39,代码来源:nodeset_to_xml.ts
示例9: lookup
async lookup(req:any): Promise<HttpLookup> {
// Get the search parameter from HTTP query
const search = await ParametersService.getSearchP(req);
// Make the research
const identities:any[] = await this.IdentityService.searchIdentities(search);
// Entitify each result
identities.forEach((idty, index) => identities[index] = DBIdentity.copyFromExisting(idty));
// Prepare some data to avoid displaying expired certifications
for (const idty of identities) {
const certs = await this.server.dal.certsToTarget(idty.pubkey, idty.getTargetHash());
const validCerts = [];
for (const cert of certs) {
const member = await this.IdentityService.getWrittenByPubkey(cert.from);
if (member) {
cert.uids = [member.uid];
cert.isMember = member.member;
cert.wasMember = member.wasMember;
} else {
const potentials = await this.IdentityService.getPendingFromPubkey(cert.from);
cert.uids = _(potentials).pluck('uid');
cert.isMember = false;
cert.wasMember = false;
}
validCerts.push(cert);
}
idty.certs = validCerts;
const signed = await this.server.dal.certsFrom(idty.pubkey);
const validSigned = [];
for (let j = 0; j < signed.length; j++) {
const cert = _.clone(signed[j]);
cert.idty = await this.server.dal.getIdentityByHashOrNull(cert.target);
if (cert.idty) {
validSigned.push(cert);
} else {
this.logger.debug('A certification to an unknown identity was found (%s => %s)', cert.from, cert.to);
}
}
idty.signed = validSigned;
}
if (identities.length == 0) {
throw BMAConstants.ERRORS.NO_MATCHING_IDENTITY;
}
const resultsByPubkey:any = {};
identities.forEach((identity) => {
const copy = DBIdentity.copyFromExisting(identity)
const jsoned = copy.json();
if (!resultsByPubkey[jsoned.pubkey]) {
// Create the first matching identity with this pubkey in the map
resultsByPubkey[jsoned.pubkey] = jsoned;
} else {
// Merge the identity with the existing(s)
const existing = resultsByPubkey[jsoned.pubkey];
// We add the UID of the identity to the list of already added UIDs
existing.uids = existing.uids.concat(jsoned.uids);
// We do not merge the `signed`: every identity with the same pubkey has the same `signed` because it the *pubkey* which signs, not the identity
}
});
return {
partial: false,
results: _.values(resultsByPubkey)
};
}
开发者ID:duniter,项目名称:duniter,代码行数:62,代码来源:wot.ts
示例10: threads
.subscribe((threadIdx: { [key: string]: Thread }) => {
const threads = _.values(threadIdx);
const threadNames = _.map(threads, (t: Thread) => t.name);
console.log(` => threads (${threads.length}: ${threadNames}`);
});
开发者ID:pietro909,项目名称:angular-2-chat,代码行数:5,代码来源:thread.service.spec.ts
注:本文中的underscore.values函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论