
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
object-traversed
Advanced tools
A very simple, lightweight utility on traversing object graphs using a string.
npm install --save object-traversed
yarn add object-traversed
If using via normal javascript include, then it is exported as window.objectTraverse.
var traversed = require('object-traversed');
var graph = {
field : {
deep : {
x : 1,
y: 2
}
},
field2: [],
deepFunc : { someFunc: function(arg) {} }
};
//get a value
traversed(graph).get('field.deep');
//get with a default
traversed(graph).get('field.deep','default return val if not found');
//check if something is defined
traversed(graph).has('field.deep.missing');
//sets a value
traversed(graph).set('field.deep.z',5);
//helpers
traversed(graph).isArray('field2');
traversed(graph).isString('field2');
traversed(graph).isObject('field2');
traversed(graph).isNumber('field2');
//exec
traversed(graph).exec('deepFunc.someFunc','arg');
//delete
traversed(graph).delete('field.deep.x');
//push - add vall to the array, will create if it doesn't exists
traversed(graph).push('a.b.c',val);
//create create the given path if it doesn't exists, will skip none object types
traversed(graph).create('a.b.c');
traversed(graph).get('a.b.c'); //{ a : { b : { c: {} } }
MIT © ChantouchSek
FAQs
Parse, check and traverse javascript objects via string path
We found that object-traversed 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
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.