UNPKG

348 BJavaScriptView Raw
1'use strict';
2var lengthOfArrayLike = require('../internals/length-of-array-like');
3
4module.exports = function (Constructor, list, $length) {
5 var index = 0;
6 var length = arguments.length > 2 ? $length : lengthOfArrayLike(list);
7 var result = new Constructor(length);
8 while (length > index) result[index] = list[index++];
9 return result;
10};