3 var toPosInt = require('../number/to-pos-integer')
4 , value = require('../object/valid-value')
6 , slice = Array.prototype.slice;
8 module.exports = function (length/*, …fill*/) {
10 length = toPosInt(value(length));
11 if (length === 0) return [];
13 arr = (arguments.length < 2) ? [undefined] :
14 slice.call(arguments, 1, 1 + length);
16 while ((l = arr.length) < length) {
17 arr = arr.concat(arr.slice(0, length - l));