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


TypeScript underscore.range函數代碼示例

本文整理匯總了TypeScript中underscore.range函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript range函數的具體用法?TypeScript range怎麽用?TypeScript range使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了range函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: map

 args.results.results.forEach(res => {
   const amountOfLike = Math.floor(Math.random() * 15);
   const likedBy = map(range(0, amountOfLike), val => val).join(';') || null;
   res.raw.sflikedby = likedBy;
   res.raw.sflikedbyid = likedBy;
   res.raw.sflikecount = amountOfLike;
 });
開發者ID:coveo,項目名稱:search-ui,代碼行數:7,代碼來源:AccessibilityChatterLikedBy.ts

示例2: describe

      describe('game with last row full', ()=> {
        var game = new Models.Game(()=>{});
        game.rubble = _.range(1, game.cols+1).map(col => new Models.Point(game.rows, col));

        it('should have one completed row', ()=> assert.equal(1, game.completedRows().length));
        it('should have row 15 as completed', ()=> assert.equal(15, game.completedRows()[0]));
      });
開發者ID:kristianmandrup,項目名稱:tetris,代碼行數:7,代碼來源:modelsTests.ts

示例3: getYearValues

 static getYearValues(futureDates: boolean, yearsFromNow = 110, startCap = 0) {
   let r = _.range(0, yearsFromNow).map(i => futureDates ? moment().add(i, 'years').year() : moment().subtract(i, 'years').year());
   if (startCap) {
     return futureDates ? _.reject(r, v => v < startCap) : _.reject(r, v => v > startCap);
   }
   return r;
 }
開發者ID:Rocketmakers,項目名稱:armstrong-react,代碼行數:7,代碼來源:dateHelpers.ts

示例4: Cell

 _.each(_.range(this.size), (row:number) => {
     _.each(_.range(this.size), (column:number) => {
         this.cells.add(new Cell({
             row,
             column
         }));
     });
 });
開發者ID:joppe,項目名稱:2048,代碼行數:8,代碼來源:Grid.ts

示例5: it

        it('replaces the tabs in the correct order in the original section', () => {
          simulateOverflowing();
          responsiveTabs.handleResizeEvent();
          simulateNotOverflowing();
          responsiveTabs.handleResizeEvent();

          range(0, 5).forEach(tabThatShouldBeInStandardSection => {
            expect(tabSection.find(`div[data-id="${tabThatShouldBeInStandardSection}"]`)).not.toBeNull();
          });
        });
開發者ID:coveo,項目名稱:search-ui,代碼行數:10,代碼來源:ResponsiveTabsTest.ts

示例6: verifyChildren

 function verifyChildren(numberOfValues: number) {
   removeAllCategoriesButton(test.cmp.element);
   const categoryValues = $$(test.cmp.element).findAll('.coveo-category-facet-child-value');
   for (const i of range(0, numberOfValues)) {
     const valueCaption = $$(categoryValues[i]).find('.coveo-category-facet-value-caption');
     const valueCount = $$(categoryValues[i]).find('.coveo-category-facet-value-count');
     expect($$(valueCaption).text()).toEqual(`value${i}`);
     expect($$(valueCount).text()).toEqual('5');
   }
 }
開發者ID:francoislg,項目名稱:search-ui,代碼行數:10,代碼來源:CategoryFacetTest.ts

示例7: verifyParents

 function verifyParents(numberOfParents: number) {
   removeAllCategoriesButton(test.cmp.element);
   const parentCategoryValues = $$(test.cmp.element).findAll('.coveo-category-facet-parent-value');
   for (const i of range(numberOfParents)) {
     const valueCaption = $$(parentCategoryValues[i]).find('.coveo-category-facet-value-caption');
     const valueCount = $$(parentCategoryValues[i]).find('.coveo-category-facet-value-count');
     expect($$(valueCaption).text()).toEqual(`parent${i}`);
     expect($$(valueCount).text()).toEqual('5');
   }
 }
開發者ID:francoislg,項目名稱:search-ui,代碼行數:10,代碼來源:CategoryFacetTest.ts

示例8: constructor

    /**
     * Initialize the grid by creating the necessary cells.
     */
    constructor(attributes:GridLiteralInterface) {
        super(attributes);

        _.each(_.range(this.size), (row:number) => {
            _.each(_.range(this.size), (column:number) => {
                this.cells.add(new Cell({
                    row,
                    column
                }));
            });
        });
    }
開發者ID:joppe,項目名稱:2048,代碼行數:15,代碼來源:Grid.ts

示例9: beforeEach

    beforeEach(() => {
      dataSource = range(0, 50).map(iterator => {
        return {
          value: {
            content: iterator.toString()
          }
        };
      });

      successSpy = jasmine.createSpy('successSpy');
      failSpy = jasmine.createSpy('failSpy');
      fieldsDataSource = new AvailableFieldsDatasource(dataSource);
    });
開發者ID:coveo,項目名稱:search-ui,代碼行數:13,代碼來源:AvailableFieldsDatasourceTest.ts


注:本文中的underscore.range函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。