
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Update only existing values from an object, works with dot notation paths like `a.b.c` and support deep nesting.
Update only existing values from an object, works with dot notation paths like
a.b.cand support deep nesting.
key only if key existsobj when object is given to keyset-value update values if exist and add if not existkey is not an object or stringobj is not an objectnpm i put-value --save
npm test
For more use-cases see the tests
var put = require('put-value')
var obj = {
a: {
foo: 'bar'
},
b: {
bb: 'bbb'
}
}
put(123) //=> empty object {}
put(obj, {a: {bar: 'baz'}}) //=> original `obj`
put(obj, {a: 'foo'}})
//=> {
// a: 'foo',
// b: {
// bb: 'bbb'
// }
// }
put(obj, {zzz: 'xxx'}) //=> original `obj`
put(obj, 'foo', 'baz') //=> original `obj`
put(obj, 'foo.bar', 'baz') //=> original `obj`
put(obj, 'a', {foo: 123})
//=> {
// a: {
// foo: 123
// },
// b: {
// bb: 'bbb'
// }
// }
put(obj, 'a.foo', {baz: 'aaa'})
//=> {
// a: {
// foo: {
// baz: 'aaa'
// }
// },
// b: {
// bb: 'bbb'
// }
// }
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.
FAQs
Update only existing values from an object, works with dot notation paths like `a.b.c` and support deep nesting.
We found that put-value demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.