Skip to content

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 _ from 'radashi'
_.set({}, 'name', 'ra')
// => { name: 'ra' }
_.set({}, 'cards[0].value', 2)
// => { cards: [{ value: 2 }] }