當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript algorithm.iter函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。