main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
671 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | /* eslint-disable es/no-bigint -- safe */
|
---|
3 | var $ = require('../internals/export');
|
---|
4 | var NumericRangeIterator = require('../internals/numeric-range-iterator');
|
---|
5 |
|
---|
6 | var $TypeError = TypeError;
|
---|
7 |
|
---|
8 | // `Iterator.range` method
|
---|
9 | // https://github.com/tc39/proposal-Number.range
|
---|
10 | $({ target: 'Iterator', stat: true, forced: true }, {
|
---|
11 | range: function range(start, end, option) {
|
---|
12 | if (typeof start == 'number') return new NumericRangeIterator(start, end, option, 'number', 0, 1);
|
---|
13 | if (typeof start == 'bigint') return new NumericRangeIterator(start, end, option, 'bigint', BigInt(0), BigInt(1));
|
---|
14 | throw new $TypeError('Incorrect Iterator.range arguments');
|
---|
15 | }
|
---|
16 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.