MCPcopy
hub / github.com/lodash/lodash / baseNth

Function baseNth

lodash.js:3750–3757  ·  view source on GitHub ↗

* The base implementation of `_.nth` which doesn't coerce arguments. * * @private * @param {Array} array The array to query. * @param {number} n The index of the element to return. * @returns {*} Returns the nth element of `array`.

(array, n)

Source from the content-addressed store, hash-verified

3748 * @returns {*} Returns the nth element of `array`.
3749 */
3750 function baseNth(array, n) {
3751 var length = array.length;
3752 if (!length) {
3753 return;
3754 }
3755 n += n < 0 ? length : 0;
3756 return isIndex(n, length) ? array[n] : undefined;
3757 }
3758
3759 /**
3760 * The base implementation of `_.orderBy` without param guards.

Callers 2

nthFunction · 0.85
nthArgFunction · 0.85

Calls 1

isIndexFunction · 0.85

Tested by

no test coverage detected