MultiLoader-Template/node_modules/es-toolkit/dist/compat/array/nth.d.mts
3944Realms 768f38fc97 feat: 可使用的构建模板
修改了脚本,使其可以推给Maven仓库
2026-05-03 13:02:19 +08:00

15 lines
501 B
TypeScript

/**
* Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned.
*
* @param {ArrayLike<T> | null | undefined} array - The array to query.
* @param {number} [n=0] - The index of the element to return.
* @return {T | undefined} Returns the nth element of `array`.
*
* @example
* nth([1, 2, 3], 1); // => 2
* nth([1, 2, 3], -1); // => 3
*/
declare function nth<T>(array: ArrayLike<T> | null | undefined, n?: number): T | undefined;
export { nth };