CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
nth.js30 linesDownload Raw Back to lodash-es
1import baseNth from './_baseNth.js';2import toInteger from './toInteger.js';3 4/**5 * Gets the element at index `n` of `array`. If `n` is negative, the nth6 * element from the end is returned.7 *8 * @static9 * @memberOf _10 * @since 4.11.011 * @category Array12 * @param {Array} array The array to query.13 * @param {number} [n=0] The index of the element to return.14 * @returns {*} Returns the nth element of `array`.15 * @example16 *17 * var array = ['a', 'b', 'c', 'd'];18 *19 * _.nth(array, 1);20 * // => 'b'21 *22 * _.nth(array, -2);23 * // => 'c';24 */25function nth(array, n) {26  return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;27}28 29export default nth;30 
basant307/AI_Governance_Project · CoolFace