UNPKG

rambdax

Version:

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

16 lines (12 loc) 328 B
import { cloneList } from './_internals/cloneList.js' import { curry } from './curry.js' export function updateFn( index, newValue, list ){ const clone = cloneList(list) if (index === -1) return clone.fill(newValue, index) return clone.fill( newValue, index, index + 1 ) } export const update = curry(updateFn)