Skip to main content
Module

x/rambda/adjust.js

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