initial.js 380 B

1234567891011
  1. var _setup = require('./_setup.js');
  2. // Returns everything but the last entry of the array. Especially useful on
  3. // the arguments object. Passing **n** will return all the values in
  4. // the array, excluding the last N.
  5. function initial(array, n, guard) {
  6. return _setup.slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
  7. }
  8. module.exports = initial;