Skip to content

Releases: akuzko/update-js

v1.9.0

25 Sep 21:25
Compare
Choose a tag to compare

Release Description

  • Added ability to specify custom strategy for handling attempts to update using lookup keys with no corresponding object in the array by specifying update.onLookupMissingObject handler. As mentioned in the README, update-js/utils provides 3 predefined strategies: noop, warnOnMissing and throwOnMissing. The default strategy is noop.
  • This feature was requested by @AleksandrZhukov

v1.8.0

23 Sep 19:36
Compare
Choose a tag to compare

Release Description

  • Fixed the behavior of lookup-key updates to ignore unsuccessful attempts of updating object that are not found in collection anymore. In case exception is desired, one should set update.throwOnLookupMissingObject flag to true.

v1.7.3

23 May 21:58
Compare
Choose a tag to compare

Patch Description

  • Source code and package infrastructure has been reorganized to depend on babel-transpiled ES6 code (instead of requiring to have ES5-compatible code).
  • Some additional related refactoring has been made as well, including refactoring of tests.
  • update-js now depends on get-lookup package for lookup-key-related behavior and functionality.

v1.7.2

20 May 21:07
Compare
Choose a tag to compare

Patch Updates

  • Fixed flaw in object field lookup regexp preventing usage of multi-field lookup keys. Although it was stated in README, it looks like this feature has never actually worked properly.

v1.7.1

24 Mar 21:14
Compare
Choose a tag to compare

Patch Updates

  • Fixed bug happening when looking up item in array with null elements in it. #4 by @AleksandrZhukov

v1.7.0

25 Mar 12:51
Compare
Choose a tag to compare

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' }] } }

v1.6.1

10 Dec 20:44
Compare
Choose a tag to compare

Patch Updates

  • Fixed bug in path recognition regexp that prevented from using - symbols in path lookup keys. #1 by @AleksandrZhukov

v1.6.0

23 Jul 20:45
Compare
Choose a tag to compare

New Features

  • Added update-js/fp module. update function from this module generates a transformation-currying function that accepts an update subject as it's only argument, for example:
import update from 'update-js/fp';

update('foo.bar.baz', 5)(obj);
// but the main use case is to pass returned function as a callback to
// object-updating functions, like so:
setState(update('foo.bar.baz', 5));
  • Updated README

v1.5.0

06 Jul 23:03
Compare
Choose a tag to compare

New Features

  • Added update.unshift array helper method. It is aliased with array.prepend. The name is pretty self-explanatory
  • update.add is now alias of update.push array helper method

v1.4.0

06 May 16:48
Compare
Choose a tag to compare

New Features

  • Added update.assign helper that merges given object with the one specified by path:
const obj = { foo: { bar: { baz: 'bak' } } };
const upd = update.assign(obj, 'foo.bar', { spam: 'ham' });

upd.foo.bar // => { baz: 'bak', spam: 'ham' }