MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / dropRight

Function dropRight

lib/web/jshint.js:6151–6161  ·  view source on GitHub ↗

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

(array, n, guard)

Source from the content-addressed store, hash-verified

6149 * // => [1, 2, 3]
6150 */
6151 function dropRight(array, n, guard) {
6152 var length = array ? array.length : 0;
6153 if (!length) {
6154 return [];
6155 }
6156 if (guard ? isIterateeCall(array, n, guard) : n == null) {
6157 n = 1;
6158 }
6159 n = length - (+n || 0);
6160 return baseSlice(array, 0, n < 0 ? 0 : n);
6161 }
6162
6163 /**
6164 * Creates a slice of `array` excluding elements dropped from the end.

Callers 1

initialFunction · 0.85

Calls 2

isIterateeCallFunction · 0.85
baseSliceFunction · 0.85

Tested by

no test coverage detected