You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
634 B
18 lines
634 B
3 years ago
|
var global = require('../internals/global');
|
||
|
var toAbsoluteIndex = require('../internals/to-absolute-index');
|
||
|
var lengthOfArrayLike = require('../internals/length-of-array-like');
|
||
|
var createProperty = require('../internals/create-property');
|
||
|
|
||
|
var Array = global.Array;
|
||
|
var max = Math.max;
|
||
|
|
||
|
module.exports = function (O, start, end) {
|
||
|
var length = lengthOfArrayLike(O);
|
||
|
var k = toAbsoluteIndex(start, length);
|
||
|
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
||
|
var result = Array(max(fin - k, 0));
|
||
|
for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
|
||
|
result.length = n;
|
||
|
return result;
|
||
|
};
|