set
Set a value on an object using a path key
616 bytes
Usage
Opposite of get, dynamically set a nested value into an object using a key path. Does not modify the given initial object.
import * as import _
_ from 'radashi'
import _
_.set<{}, string>(initial: {}, path: string, value: string): {}export set
Opposite of get, dynamically set a nested value into an object
using a key path. Does not modify the given initial object.
set({}, 'name', 'ra')// => { name: 'ra' }
import _
_.set<{}, number>(initial: {}, path: string, value: number): {}export set
Opposite of get, dynamically set a nested value into an object
using a key path. Does not modify the given initial object.
set({}, 'cards[0].value', 2)// => { cards: [{ value: 2 }] }