本文整理汇总了TypeScript中@phosphor/algorithm.iter函数的典型用法代码示例。如果您正苦于以下问题:TypeScript iter函数的具体用法?TypeScript iter怎么用?TypeScript iter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iter函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: testIterator
testIterator(() => {
let a = iter([1, 2, 3]);
let b = iter(['four', 'five']);
let c = iter([true, false]);
type T = number | string | boolean;
let it = new ChainIterator<T>(iter([a, b, c]));
let expected = [1, 2, 3, 'four', 'five', true, false];
return [it, expected];
});
开发者ID:afshin,项目名称:phosphor,代码行数:9,代码来源:chain.spec.ts
示例2: testIterator
testIterator(() => {
let i1 = iter(['one', 'two']);
let i2 = iter([1, 2]);
let i3 = iter([true, false]);
type T = string | number | boolean;
let it = new ZipIterator<T>([i1, i2, i3]);
let results = [['one', 1, true], ['two', 2, false]];
return [it, results];
});
开发者ID:afshin,项目名称:phosphor,代码行数:9,代码来源:zip.spec.ts
示例3: createRowsWithGeneratedIndex
createRowsWithGeneratedIndex(data) {
this.rowsIterator = new MapIterator<any[], DataGridRow>(
iter(data),
(values, index) => new DataGridRow(index, values)
);
this.rows = toArray(this.rowsIterator.clone());
}
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:7,代码来源:RowManager.ts
示例4: createRowsWithIndex
createRowsWithIndex(data) {
this.rowsIterator = new MapIterator<any[], DataGridRow>(
iter(data),
(values) => new DataGridRow(values[0], values.slice(1)
));
this.rows = toArray(this.rowsIterator.clone());
}
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:8,代码来源:RowManager.ts
示例5: switch
const findTab = (
area: DockLayout.AreaConfig,
widget: Widget
): DockLayout.ITabAreaConfig | null => {
switch (area.type) {
case 'split-area':
const iterator = iter(area.children);
let tab: DockLayout.ITabAreaConfig | null = null;
let value: DockLayout.AreaConfig | null = null;
do {
value = iterator.next();
if (value) {
tab = findTab(value, widget);
}
} while (!tab && value);
return tab;
case 'tab-area':
const { id } = widget;
return area.widgets.some(widget => widget.id === id) ? area : null;
default:
return null;
}
};
开发者ID:SylvainCorlay,项目名称:jupyterlab,代码行数:23,代码来源:index.ts
示例6: testIterator
testIterator(() => {
return [new TakeIterator(iter([0, 1, 2, 3]), 1), [0]];
});
开发者ID:afshin,项目名称:phosphor,代码行数:3,代码来源:take.spec.ts
示例7: testIterator
testIterator(() => {
let result = [0, 1, 8, 27];
let it = new MapIterator(iter([0, 1, 2, 3]), x => x ** 3);
return [it, result];
});
开发者ID:afshin,项目名称:phosphor,代码行数:5,代码来源:map.spec.ts
示例8: it
it('should call `iter` on an iterable', () => {
let iterator = iter([1, 2, 3, 4]);
expect(iter(iterator)).to.equal(iterator);
});
开发者ID:afshin,项目名称:phosphor,代码行数:4,代码来源:iter.spec.ts
示例9: testIterator
testIterator(() => {
let expected = [1, 3, 5];
let data = [0, 1, 2, 3, 4, 5];
let it = new FilterIterator(iter(data), n => n % 2 !== 0);
return [it, expected];
});
开发者ID:afshin,项目名称:phosphor,代码行数:6,代码来源:filter.spec.ts
注:本文中的@phosphor/algorithm.iter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论