本文整理匯總了TypeScript中app/core/utils/flatten.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: flatten
getColumns: data => {
if (!data || data.length === 0) {
return [];
}
const names: any = {};
for (let i = 0; i < data.length; i++) {
const series = data[i];
if (series.type !== 'docs') {
continue;
}
// only look at 100 docs
const maxDocs = Math.min(series.datapoints.length, 100);
for (let y = 0; y < maxDocs; y++) {
const doc = series.datapoints[y];
const flattened = flatten(doc, null);
for (const propName in flattened) {
names[propName] = true;
}
}
}
return _.map(names, (value, key) => {
return { text: key, value: key };
});
},
示例2: it
it('should return flatten object', () => {
var flattened = flatten({
level1: 'level1-value',
deeper: {
level2: 'level2-value',
deeper: {
level3: 'level3-value'
}
}
}, null);
expect(flattened['level1']).to.be('level1-value');
expect(flattened['deeper.level2']).to.be('level2-value');
expect(flattened['deeper.deeper.level3']).to.be('level3-value');
});