本文整理汇总了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];
});
示例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];
});
示例3: createRowsWithGeneratedIndex
createRowsWithGeneratedIndex(data) {
this.rowsIterator = new MapIterator<any[], DataGridRow>(
iter(data),
(values, index) => new DataGridRow(index, values)
);
this.rows = toArray(this.rowsIterator.clone());
}
示例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());
}
示例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;
}
};
示例6: testIterator
testIterator(() => {
return [new TakeIterator(iter([0, 1, 2, 3]), 1), [0]];
});
示例7: testIterator
testIterator(() => {
let result = [0, 1, 8, 27];
let it = new MapIterator(iter([0, 1, 2, 3]), x => x ** 3);
return [it, result];
});
示例8: it
it('should call `iter` on an iterable', () => {
let iterator = iter([1, 2, 3, 4]);
expect(iter(iterator)).to.equal(iterator);
});
示例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];
});