initial.js 393 B

123456789101112
  1. define(['./_setup'], function (_setup) {
  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. return initial;
  9. });