Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
517 bytes
|
Line | |
---|
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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.