Skip to main content
Module

x/rambda/nth.js

Faster and smaller alternative to Ramda
Go to Latest
File
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 ]}