UNPKG

rambdax

Version:

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

8 lines (6 loc) 290 B
export function removeIndex(list, index){ if (arguments.length === 1) return _index => removeIndex(list, _index) 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) ] }