Files
eewing cf73cd3b4c INIT
2026-02-17 14:10:16 -06:00

15 lines
297 B
JavaScript

/**
* Get nth item of Array. Negative for backward
*/
export function at(array, index) {
const len = array.length;
if (!len)
return undefined;
if (index < 0)
index += len;
return array[index];
}
export function last(array) {
return array[array.length - 1];
}