UNPKG

rambdax

Version:

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

8 lines (6 loc) 289 B
export function removeIndex(index, list){ if (arguments.length === 1) return _list => removeIndex(index, _list) if (index <= 0) return list.slice(1) if (index >= list.length - 1) return list.slice(0, list.length - 1) return [ ...list.slice(0, index), ...list.slice(index + 1) ] }