
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.
object-path-set
Advanced tools
set values in javascript objects by specifying a path.
if the path doesn't exist yet, it will be created.
by using this library, you can help prevent the following error from occurring:
Cannot set property 'foo' of undefined
NOTE: I've re-written / used this function so many different times, I decided to publish it as a module.
Install the module with: npm install --save object-path-set
var setPath = require('object-path-set');
var obj = { foo: { bar: 'baz' } };
obj = setPath(obj, 'foo.bar', 'newValue'); // result: {foo:{bar:'newValue'}}
obj = setPath(obj, 'foo.invalidKey', 'cool'); // result: {foo:{bar:'newValue',invalidKey: 'cool'}}
obj = setPath(obj, 'foo|bar', 'again', '|'); // result: {foo:{bar:'again',invalidKey: 'cool'}}
Thanks goes to these wonderful people (emoji key):
◬ 💻 📖 |
|---|
This project follows the all-contributors specification. Contributions of any kind welcome!
Copyright (c) 2014 skratchdot
Licensed under the MIT license.
FAQs
set values in javascript objects by specifying a path
We found that object-path-set 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.