UNPKG

rambda

Version:

Lightweight and faster alternative to Ramda with included TS definitions

13 lines (10 loc) 278 B
import { cloneList } from './_internals/cloneList.js' export function update(index, newValue) { return list => { const clone = cloneList(list) if (index === -1) { return clone.fill(newValue, index) } return clone.fill(newValue, index, index + 1) } }