1 var isIndex = require('./_isIndex');
4 * The base implementation of `_.nth` which doesn't coerce arguments.
7 * @param {Array} array The array to query.
8 * @param {number} n The index of the element to return.
9 * @returns {*} Returns the nth element of `array`.
11 function baseNth(array, n) {
12 var length = array.length;
16 n += n < 0 ? length : 0;
17 return isIndex(n, length) ? array[n] : undefined;
20 module.exports = baseNth;