UNPKG

671 BJavaScriptView Raw
1'use strict';
2/* eslint-disable es/no-bigint -- safe */
3var $ = require('../internals/export');
4var NumericRangeIterator = require('../internals/numeric-range-iterator');
5
6var $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});