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

Function take

lib/web/jshint.js:6959–6968  ·  view source on GitHub ↗

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

(array, n, guard)

Source from the content-addressed store, hash-verified

6957 * // => []
6958 */
6959 function take(array, n, guard) {
6960 var length = array ? array.length : 0;
6961 if (!length) {
6962 return [];
6963 }
6964 if (guard ? isIterateeCall(array, n, guard) : n == null) {
6965 n = 1;
6966 }
6967 return baseSlice(array, 0, n < 0 ? 0 : n);
6968 }
6969
6970 /**
6971 * Creates a slice of `array` with `n` elements taken from the end.

Callers

nothing calls this directly

Calls 2

isIterateeCallFunction · 0.85
baseSliceFunction · 0.85

Tested by

no test coverage detected