Skip to main content
Module

x/rambda/updateObject.js

Faster and smaller alternative to Ramda
Go to Latest
File
import { assocPath } from './assocPath'
export function updateObject(rules, obj){ if (arguments.length === 1) return _obj => updateObject(rules, _obj)
let clone = { ...obj } /*?.*/
rules.forEach(([ objectPath, newValue ]) => { clone = assocPath( objectPath, newValue, clone ) })
return clone}