本文整理匯總了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);
});