MCPcopy
hub / github.com/lodash/lodash / baseSlice

Function baseSlice

lodash.js:4109–4128  ·  view source on GitHub ↗

* The base implementation of `_.slice` without an iteratee call guard. * * @private * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of

(array, start, end)

Source from the content-addressed store, hash-verified

4107 * @returns {Array} Returns the slice of `array`.
4108 */
4109 function baseSlice(array, start, end) {
4110 var index = -1,
4111 length = array.length;
4112
4113 if (start < 0) {
4114 start = -start > length ? 0 : (length + start);
4115 }
4116 end = end > length ? length : end;
4117 if (end < 0) {
4118 end += length;
4119 }
4120 length = start > end ? 0 : ((end - start) >>> 0);
4121 start >>>= 0;
4122
4123 var result = Array(length);
4124 while (++index < length) {
4125 result[index] = array[index + start];
4126 }
4127 return result;
4128 }
4129
4130 /**
4131 * The base implementation of `_.some` without support for iteratee shorthands.

Callers 11

baseWhileFunction · 0.85
castSliceFunction · 0.85
parentFunction · 0.85
chunkFunction · 0.85
dropFunction · 0.85
dropRightFunction · 0.85
initialFunction · 0.85
sliceFunction · 0.85
tailFunction · 0.85
takeFunction · 0.85
takeRightFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected