Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / baseSlice.js
1 /**
2  * The base implementation of `_.slice` without an iteratee call guard.
3  *
4  * @private
5  * @param {Array} array The array to slice.
6  * @param {number} [start=0] The start position.
7  * @param {number} [end=array.length] The end position.
8  * @returns {Array} Returns the slice of `array`.
9  */
10 function baseSlice(array, start, end) {
11   var index = -1,
12       length = array.length;
13
14   start = start == null ? 0 : (+start || 0);
15   if (start < 0) {
16     start = -start > length ? 0 : (length + start);
17   }
18   end = (end === undefined || end > length) ? length : (+end || 0);
19   if (end < 0) {
20     end += length;
21   }
22   length = start > end ? 0 : ((end - start) >>> 0);
23   start >>>= 0;
24
25   var result = Array(length);
26   while (++index < length) {
27     result[index] = array[index + start];
28   }
29   return result;
30 }
31
32 module.exports = baseSlice;