本文整理汇总了TypeScript中lodash/forEach.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: refresh
/**
* Refresh the list of zazus from the storage.
*/
refresh () {
const data = JSON.parse(this.storage.getItem(this.db));
this.zazus = [];
_forEach(data, (zazuData) => {
this.zazus.push(new Zazu(zazuData));
});
}
示例2: flattenBool
function flattenBool(operator, arr) {
// Flatten bool.must
var newArr = []
forEach(arr, node => {
if (isBoolOp(operator, node)) {
newArr.push(...node.bool[operator])
} else {
newArr.push(node)
}
})
return newArr
}
示例3: buildSharedQuery
buildSharedQuery(query){
let queryStr = this.state.getValue()
if(queryStr){
let queryBuilder = this.options.queryBuilder || SimpleQueryString
let simpleQuery = queryBuilder(
queryStr, assign(
{fields:this.options.queryFields},
this.options.queryOptions
)
)
let queries:Array<any> = [simpleQuery]
if (this.options.prefixQueryFields) {
let terms = String(queryStr).match(/\S+/g)
let prefixQueries:Array<any> = [MultiMatchQuery(terms.pop(), assign(
this.options.prefixQueryOptions, {
type:"phrase_prefix",
fields:this.options.prefixQueryFields,
})
)]
forEach(terms, function(q) {
prefixQueries.push(MultiMatchQuery(q, assign(
this.options.prefixQueryOptions, {
type:"phrase",
fields:this.options.prefixQueryFields,
})
))
}.bind(this))
queries.push(BoolMust(prefixQueries))
}
query = query.addQuery(BoolShould(queries))
if (this.options.addToFilters){
query = query.addSelectedFilter({
name: this.options.title,
value: queryStr,
id: this.key,
remove: () => this.state = this.state.clear()
})
} else {
query = query.setQueryString(queryStr)
}
return query
}
return query
}
示例4: function
return function () {
let blueprintPath = path.join(root, dir, 'files');
let expected = walkSync(blueprintPath);
let actual = walkSync('.').sort();
let directory = path.basename(process.cwd());
forEach(Blueprint.renamedFiles, function (destFile, srcFile) {
expected[expected.indexOf(srcFile)] = destFile;
});
expected.forEach(function (file, index) {
expected[index] = file.replace(/__name__/g, 'angular-cli');
});
expected.sort();
expect(directory).to.equal('foo');
expect(expected).to.deep.equal(
actual,
EOL + ' expected: ' + util.inspect(expected) + EOL + ' but got: ' + util.inspect(actual));
};