Urara-Blog/node_modules/.pnpm-store/v3/files/6c/8981364fa46fb1846c8b915f07202024d96855fb7db5d53f47b9464a54c5ffa9b150359a35dc76fa3a79127c260e7c33284338c007adc4d34ce3bf51e02998
2022-08-14 01:14:53 +08:00

20 lines
483 B
Text

var isIndex = require('./_isIndex');
/**
* 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`.
*/
function baseNth(array, n) {
var length = array.length;
if (!length) {
return;
}
n += n < 0 ? length : 0;
return isIndex(n, length) ? array[n] : undefined;
}
module.exports = baseNth;