Releases: lukeed/dset
v3.1.3
v3.1.2
v3.1.1
Patches
- Use
while
loop (#29): fa0f75c
Thank you @rohit2sharma95~!
Chores
Full Changelog: v3.1.0...v3.1.1
v3.1.0
Features
-
Added
dset/merge
submodule: 5aed5d1, 8d0224d, 8ee6d12
This is an opt-in module, inspired by GraphQL's upcoming@stream
and@defer
directives.
The purpose of this submodule is to merge mutations from multiple sources into a single payload. It will merge new values into existing/previous values, whereasdset
(main mode) will replace values at the specified key-path outright. In code, this difference roughly translates to this distinction:// dset (main) target.key = { value: 'new value' }; // dset/merge Object.assign(target.key, { value: 'new value' })
See Merging and
test/suites/objects.js
for more information.
Chores
v3.0.0
Breaking
-
Overwrites existing, non-object values as needed: 569955d
Nowdset
is inline withlodash/set
andset-value
behaviorslet input = { foo: 123 }; dset(input, 'foo.bar', 456); console.log(input); //=> (Before) { foo: 123 } -- no change //=> (After) { foo: { bar: 456 } } -- convert "foo" to object
-
Use named
dset
export instead ofdefault
export: 7ac17ed-import dset from 'dset'; +import { dset } from 'dset';
-
Exit loop when unsafe key(s) encountered (#22): 0a11c8a
Previously, as of v2.1.0,dset
skipped over the offending key, but continued processing those after it.
Nowdset
matches thelodash/set
behavior, abandoning the currentdset()
execution entirely.
Features
- Add
"exports"
map for native ESM support: fa7ab74 - Add support for keys with
number
type (#12): 5b09e52
Previously,dset(input, ['foo', 1], 123)
failed because1
was a number.
Now,['foo', 1]
is treated the same as['foo', '1']
and'foo.1'
Chores
v2.1.0
Features
Patches
- Protect against prototype pollution: a4b8a93
Skip assignments to keys named__proto__
,constructor
, orprototype
.
Versions between1.0.0
and2.0.1
(inclusive) are now marked as deprecated.
Thank you @arjunshibu~!