MCPcopy
hub / github.com/lodash/lodash / slice

Function slice

lodash.js:8006–8020  ·  view source on GitHub ↗

* Creates a slice of `array` from `start` up to, but not including, `end`. * * **Note:** This method is used instead of * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are * returned. * * @static * @memberOf _ * @since 3.0.0 * @catego

(array, start, end)

Source from the content-addressed store, hash-verified

8004 * @returns {Array} Returns the slice of `array`.
8005 */
8006 function slice(array, start, end) {
8007 var length = array == null ? 0 : array.length;
8008 if (!length) {
8009 return [];
8010 }
8011 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
8012 start = 0;
8013 end = length;
8014 }
8015 else {
8016 start = start == null ? 0 : toInteger(start);
8017 end = end === undefined ? length : toInteger(end);
8018 }
8019 return baseSlice(array, start, end);
8020 }
8021
8022 /**
8023 * Uses a binary search to determine the lowest index at which `value`

Callers

nothing calls this directly

Calls 3

isIterateeCallFunction · 0.85
toIntegerFunction · 0.85
baseSliceFunction · 0.85

Tested by

no test coverage detected