1 | var baseSlice = require('./_baseSlice');
|
2 |
|
3 | /**
|
4 | * Casts `array` to a slice if it's needed.
|
5 | *
|
6 | * @private
|
7 | * @param {Array} array The array to inspect.
|
8 | * @param {number} start The start position.
|
9 | * @param {number} [end=array.length] The end position.
|
10 | * @returns {Array} Returns the cast slice.
|
11 | */
|
12 | function castSlice(array, start, end) {
|
13 | var length = array.length;
|
14 | end = end === undefined ? length : end;
|
15 | return (!start && end >= length) ? array : baseSlice(array, start, end);
|
16 | }
|
17 |
|
18 | module.exports = castSlice;
|