Skip to main content
Module

x/rambda/source/adjust.js

Faster and smaller alternative to Ramda
Latest
File
import { cloneList } from './_internals/cloneList.js'import { curry } from './curry.js'
function adjustFn( index, replaceFn, list){ const actualIndex = index < 0 ? list.length + index : index if (index >= list.length || actualIndex < 0) return list
const clone = cloneList(list) clone[ actualIndex ] = replaceFn(clone[ actualIndex ])
return clone}
export const adjust = curry(adjustFn)