Skip to content

v1.7.0

Compare
Choose a tag to compare
@akuzko akuzko released this 25 Mar 12:51
· 17 commits to master since this release

New Features

  • Added ability to use update helpers with multi-key updates. To do this, you have to call them without first obj and path arguments when assigning a value for path key in path object that describes different updates:
const obj = { foo: true, bar: { baz: [1, 2], bak: [{ a: 'a1' }, { a: 'a2' }] } };
const upd = update(obj, {
  'foo': false,
  'bar.baz': update.push(3),
  'bar.bak.{a:a2}': update.assign({ b: 'b2' })
});

upd // => { foo: false, bar: { baz: [1, 2, 3], bak: [{ a: 'a1' }, { a: 'a2', b: 'b2' }] } }