Skip to content

set

Opposite of get, dynamically set a nested value into an object using a key path. Does not modify the given initial object.

Usage

set({}, "name", "ra"); // => { name: 'ra' }
set({}, "cards[0].value", 2); // => { cards: [{ value: 2 }] }

Installation

Terminal window
npx atmx add helper set