本文整理汇总了TypeScript中lodash.concat函数的典型用法代码示例。如果您正苦于以下问题:TypeScript concat函数的具体用法?TypeScript concat怎么用?TypeScript concat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了concat函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: inject
selects = _.reduce(fields, (result, field, index) => {
let path = _.toPath(field),
table = path.shift(),
column = path.shift(),
joinModel = inject(table),
meta = this['_columns'][`_${table}`] || this['_joins'][`_${table}`];
if (meta['type'] === 'column') {
result = _.concat(result, [`${this['_tableName']}.${this['_columns'][`_${field}`]['value']} col_${index}`]);
} else if (!!column) {
result = _.concat(result, [`${joinModel['_tableName']}.${joinModel['_columns'][`_${column}`]['value']} col_${index}`]);
} else {
result = _.concat(result, _.map(joinModel['_columns'], (column, _index) => `${joinModel['_tableName']}.${column['value']} col_${index + _index}`));
}
return result;
}, selects);
开发者ID:wangxin0709,项目名称:csc-scms-node-koa,代码行数:16,代码来源:model.ts
示例2: deepDiff
deepDiff(one: Object, two: Object, path: string = ''): IDeepDiff[] {
let result: IDeepDiff[] = [];
for (var key of _.keys(one)) {
let concatPath: string = path ? path + '.' + key : key;
if (_.isPlainObject(one[key])) {
if (!_.has(two, key)) {
result.push(new DeepDiff('deleted', concatPath, one[key], null));
} else {
result = _.concat(result, this.deepDiff(one[key], two[key], path ? path + '.' + key : key));
}
} else if (_.isBoolean(one[key]) || _.isDate(one[key]) || _.isNumber(one[key])
|| _.isNull(one[key]) || _.isRegExp(one[key]) || _.isString(one[key])) {
if (!_.has(two, key)) {
result.push(new DeepDiff('deleted', concatPath, one[key], null));
} else if (_.get(one, key) !== _.get(two, key)) {
result.push(new DeepDiff('edited', concatPath, one[key], two[key]));
}
} else if (_.isArray(one[key]) && _.isArray(two[key]) && !_.isEqual(one[key], two[key])) {
result.push(new DeepDiff('array', concatPath, one[key], two[key]));
} else if (!_.has(two, key)) {
result.push(new DeepDiff('deleted', concatPath, one[key], null));
}
}
for (var key of _.keys(two)) {
let concatPath: string = path ? path + '.' + key : key;
if (!_.has(one, key)) {
if (_.isPlainObject(two[key]) || _.isBoolean(two[key]) || _.isDate(two[key]) || _.isNumber(two[key])
|| _.isNull(two[key]) || _.isRegExp(two[key]) || _.isString(two[key]) || _.isArray(two[key])) {
result.push(new DeepDiff('created', concatPath, null, two[key]));
}
}
}
return result;
}
开发者ID:fyyyyy,项目名称:chrobject,代码行数:34,代码来源:EntryAppService.ts
示例3: build
public build(groupBysDefinition): any[] {
const groupByTags = [];
if (!_.isEmpty(groupBysDefinition.tags)) {
groupByTags.push({name: "tag", tags: this.templatingUtils.replaceAll(groupBysDefinition.tags)});
}
const groupByTime = groupBysDefinition.time.map((entry) => {
return {
group_count: entry.count,
name: "time",
range_size: this.buildRangeSize(
this.samplingConverter.isApplicable(entry.interval) ?
this.samplingConverter.convert(entry.interval, entry.unit) : entry)
};
});
const groupByValue = groupBysDefinition.value.map((entry) => {
return {
name: "value",
range_size: entry
};
});
return _.concat(groupByTags, groupByTime, groupByValue);
}
开发者ID:BrandonArp,项目名称:kairosdb-datasource,代码行数:25,代码来源:group_bys_builder.ts
示例4: attributeGithubActivity
@messageListener()
async attributeGithubActivity() {
try {
// If getActivities() takes a long time to run, consider using:
// http://dexie.org/docs/WhereClause/WhereClause.startsWith()
const logs = concat(
await this.getActivities({ withCreators: false }),
await this.thanks.filter(t => t.creator_id === undefined).toArray()
).filter(a => {
return a.url.includes('https://github.com/');
});
let promises = map(logs, async a => {
let u = new URL(a.url);
let user_or_org = u.pathname.split('/')[1];
if (user_or_org.length > 0 && !isReserved.check(user_or_org)) {
let creator_url = `https://github.com/${user_or_org}`;
await this.updateCreator(creator_url, user_or_org);
await this.connectUrlToCreator(a.url, creator_url);
}
});
await Promise.all(promises);
return null;
} catch (err) {
throw 'Could not attribute Github activity, ' + err;
}
}
开发者ID:ActivityWatch,项目名称:thankful,代码行数:28,代码来源:db.ts
示例5: function
function(err: any, realImgInfo: {watermarks: number[][], thumbnails: number[][]}) {
// Let the neural net do its magic
console.log('Outputting final image...');
let realFinalPixels = brain.activate(_.concat(realImgInfo.watermarks[0], realImgInfo.thumbnails[0]));
outputImage(mainDir + realDir + '001.jpg', trainingImgInfo.finalDimensions.width, trainingImgInfo.finalDimensions.height, realFinalPixels);
console.log('done');
}
开发者ID:,项目名称:,代码行数:8,代码来源:
示例6: test
test('getLeveragePositions paging', async () => {
const api = new BrokerApi('', '');
const pos1 = await api.getLeveragePositions({ status: 'open', limit: 4, order: 'desc' });
const pos2 = await api.getLeveragePositions({ status: 'open', limit: 4, order: 'desc', starting_after: _.last(pos1.data).id });
const pos3 = await api.getLeveragePositions({ status: 'open', limit: 4, order: 'desc', starting_after: _.last(pos2.data).id });
const positions = _.concat(pos1.data, pos2.data, pos3.data);
expect(positions.length).toBe(9);
expect(positions[1].new_order.created_at.toISOString()).toBe('2017-10-20T22:41:59.000Z');
});
开发者ID:tangkaisky,项目名称:r2,代码行数:9,代码来源:BrokerApi.test.ts
示例7: main
async function main(sources: string[]) {
let fixtures = allFixtures;
const fixturesFromCmdline = process.env.FIXTURE;
if (fixturesFromCmdline) {
const fixtureNames = fixturesFromCmdline.split(",");
fixtures = _.filter(fixtures, fixture => _.some(fixtureNames, name => fixture.runForName(name)));
} else {
fixtures = affectedFixtures();
if (allFixtures.length !== fixtures.length) {
console.error(`* Running a subset of fixtures: ${fixtures.map(f => f.name).join(", ")}`);
}
}
// Get an array of all { sample, fixtureName } objects we'll run.
// We can't just put the fixture in there because these WorkItems
// will be sent in a message, removing all code.
const samples = _.map(fixtures, fixture => ({
fixtureName: fixture.name,
samples: fixture.getSamples(sources)
}));
const priority = _.flatMap(samples, x =>
_.map(x.samples.priority, s => ({ fixtureName: x.fixtureName, sample: s }))
);
const others = _.flatMap(samples, x =>
_.map(x.samples.others, s => ({ fixtureName: x.fixtureName, sample: s }))
);
const tests = divideParallelJobs(_.concat(priority, others));
await inParallel({
queue: tests,
workers: CPUs,
setup: async () => {
testCLI();
console.error(`* Running ${tests.length} tests between ${fixtures.length} fixtures`);
for (const fixture of fixtures) {
await execAsync(`rm -rf test/runs`);
await execAsync(`mkdir -p test/runs`);
await fixture.setup();
}
},
map: async ({ sample, fixtureName }: WorkItem, index) => {
let fixture = _.find(fixtures, { name: fixtureName }) as Fixture;
try {
await fixture.runWithSample(sample, index, tests.length);
} catch (e) {
console.trace(e);
exit(1);
}
}
});
}
开发者ID:nrkn,项目名称:quicktype,代码行数:56,代码来源:test.ts
示例8: parseQueryResult
parseQueryResult(): any {
let data: any[] = [];
let columns: any[] = [];
for (let i = 0; i < this.results.length; i++) {
if (this.results[i].result.data.tables.length === 0) {
continue;
}
columns = this.results[i].result.data.tables[0].columns;
const rows = this.results[i].result.data.tables[0].rows;
if (this.results[i].query.resultFormat === 'time_series') {
data = _.concat(data, this.parseTimeSeriesResult(this.results[i].query, columns, rows));
} else {
data = _.concat(data, this.parseTableResult(this.results[i].query, columns, rows));
}
}
return data;
}
开发者ID:grafana,项目名称:grafana,代码行数:19,代码来源:response_parser.ts
示例9: constructor
constructor(iteratees = [], orders: SortOrder[] = [SortOrder.ASC]) {
this.iteratees = iteratees;
this.orders = orders;
if (this.iteratees.length > this.orders.length) {
let diff = this.iteratees.length - this.orders.length;
let pad = this.orders[this.orders.length - 1];
this.orders = _.concat(this.orders, _.fill(Array(diff), pad));
}
}
开发者ID:nfang,项目名称:haru,代码行数:10,代码来源:query-command.ts
注:本文中的lodash.concat函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论