UNPKG

rambdax

Version:

Extended version of Rambda - a lightweight, faster alternative to Ramda

10 lines (7 loc) 265 B
export function nth(index, list){ if (arguments.length === 1) return _list => nth(index, _list) const idx = index < 0 ? list.length + index : index return Object.prototype.toString.call(list) === '[object String]' ? list.charAt(idx) : list[ idx ] }