MCPcopy
hub / github.com/lodash/lodash / dropRight

Function dropRight

lodash.js:7176–7184  ·  view source on GitHub ↗

* Creates a slice of `array` with `n` elements dropped from the end. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enable

(array, n, guard)

Source from the content-addressed store, hash-verified

7174 * // => [1, 2, 3]
7175 */
7176 function dropRight(array, n, guard) {
7177 var length = array == null ? 0 : array.length;
7178 if (!length) {
7179 return [];
7180 }
7181 n = (guard || n === undefined) ? 1 : toInteger(n);
7182 n = length - n;
7183 return baseSlice(array, 0, n < 0 ? 0 : n);
7184 }
7185
7186 /**
7187 * Creates a slice of `array` excluding elements dropped from the end.

Callers

nothing calls this directly

Calls 2

toIntegerFunction · 0.85
baseSliceFunction · 0.85

Tested by

no test coverage detected