本文整理汇总了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;
});
示例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]));
});
示例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;
}
示例4: Cell
_.each(_.range(this.size), (row:number) => {
_.each(_.range(this.size), (column:number) => {
this.cells.add(new Cell({
row,
column
}));
});
});
示例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();
});
});
示例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');
}
}
示例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');
}
}
示例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
}));
});
});
}
示例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);
});