Releases: akuzko/update-js
Releases · akuzko/update-js
v1.9.0
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
andthrowOnMissing
. The default strategy isnoop
. - This feature was requested by @AleksandrZhukov
v1.8.0
v1.7.3
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 onget-lookup
package for lookup-key-related behavior and functionality.
v1.7.2
v1.7.1
v1.7.0
New Features
- Added ability to use update helpers with multi-key updates. To do this, you have to call them without first
obj
andpath
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
v1.6.0
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