Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / array / slice.js
1 var baseSlice = require('../internal/baseSlice'),
2     isIterateeCall = require('../internal/isIterateeCall');
3
4 /**
5  * Creates a slice of `array` from `start` up to, but not including, `end`.
6  *
7  * **Note:** This method is used instead of `Array#slice` to support node
8  * lists in IE < 9 and to ensure dense arrays are returned.
9  *
10  * @static
11  * @memberOf _
12  * @category Array
13  * @param {Array} array The array to slice.
14  * @param {number} [start=0] The start position.
15  * @param {number} [end=array.length] The end position.
16  * @returns {Array} Returns the slice of `array`.
17  */
18 function slice(array, start, end) {
19   var length = array ? array.length : 0;
20   if (!length) {
21     return [];
22   }
23   if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
24     start = 0;
25     end = length;
26   }
27   return baseSlice(array, start, end);
28 }
29
30 module.exports = slice;