dset
3.1.4 · 9 Sep 2024MIT24.3M / weekRepositoryHomepagenpmAtom feed
12 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 3.x · latest line
3.1.4
9 Sep 20243.1.1
27 Oct 2021Use
whileloop (#29): fa0f75c
Thank you @rohit2sharma95~!
Patches
Use
whileloop (#29): fa0f75c
Thank you @rohit2sharma95~!
Chores
Full Changelog: v3.1.0...v3.1.1
3.1.0
24 Feb 2021Added
dset/mergesubmodule: 5aed5d1, 8d0224d, 8ee6d12
This is an opt-in module, inspired by GraphQL's upcoming@streamand@deferdirectives.
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.jsfor more information.
Features
Added
dset/mergesubmodule: 5aed5d1, 8d0224d, 8ee6d12
This is an opt-in module, inspired by GraphQL's upcoming@streamand@deferdirectives.
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.jsfor more information.
3.0.0
28 Jan 2021- Breaking
Overwrites existing, non-object values as needed: 569955d
Nowdsetis inline withlodash/setandset-valuebehaviorslet input = { foo: 123 }; dset(input, 'foo.bar', 456); console.log(input); //=> (Before) { foo: 123 } -- no change //=> (After) { foo: { bar: 456 } } -- convert "foo" to object - Breaking
Use named
dsetexport instead ofdefaultexport: 7ac17ed-import dset from 'dset'; +import { dset } from 'dset';
Breaking
- Breaking
Overwrites existing, non-object values as needed: 569955d
Nowdsetis inline withlodash/setandset-valuebehaviorslet input = { foo: 123 }; dset(input, 'foo.bar', 456); console.log(input); //=> (Before) { foo: 123 } -- no change //=> (After) { foo: { bar: 456 } } -- convert "foo" to object - Breaking
Use named
dsetexport instead ofdefaultexport: 7ac17ed-import dset from 'dset'; +import { dset } from 'dset'; - Breaking
Exit loop when unsafe key(s) encountered (#22): 0a11c8a
Previously, as of v2.1.0,dsetskipped over the offending key, but continued processing those after it.
Nowdsetmatches thelodash/setbehavior, abandoning the currentdset()execution entirely.
Features
- 2.x
2.1.0
27 Jan 2021- Security
Protect against prototype pollution: a4b8a93
Skip assignments to keys named__proto__,constructor, orprototype.
Versions between1.0.0and2.0.1(inclusive) are now marked as deprecated.
Thank you @arjunshibu~!
Features
Patches
- Security
Protect against prototype pollution: a4b8a93
Skip assignments to keys named__proto__,constructor, orprototype.
Versions between1.0.0and2.0.1(inclusive) are now marked as deprecated.
Thank you @arjunshibu~!
2.0.0
7 Sep 2018- Breaking
NEW Write into or create new Arrays with numeric path segments (#9): e6fea6f
Thank you @bwendt-mylo 🎉
let qux = {}; dset(qux, 'a.0.b.0', 1); dset(qux, 'a.0.b.1', 2); //=> { a: [{ b: [1, 2] }] }
Major Changes
- Breaking
NEW Write into or create new Arrays with numeric path segments (#9): e6fea6f
Thank you @bwendt-mylo 🎉
let qux = {}; dset(qux, 'a.0.b.0', 1); dset(qux, 'a.0.b.1', 2); //=> { a: [{ b: [1, 2] }] }
- 1.x
- 0.0.x
0.0.0
21 Feb 2018
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.