"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/es5-ext/array/generate.js" (8 Mar 2017, 470 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

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