1 | var baseSlice = require('./_baseSlice'),
|
2 | isIterateeCall = require('./_isIterateeCall'),
|
3 | toInteger = require('./toInteger');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | function slice(array, start, end) {
|
22 | var length = array == null ? 0 : array.length;
|
23 | if (!length) {
|
24 | return [];
|
25 | }
|
26 | if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
|
27 | start = 0;
|
28 | end = length;
|
29 | }
|
30 | else {
|
31 | start = start == null ? 0 : toInteger(start);
|
32 | end = end === undefined ? length : toInteger(end);
|
33 | }
|
34 | return baseSlice(array, start, end);
|
35 | }
|
36 |
|
37 | module.exports = slice;
|