
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.
Micro-library exposing deeply-nested members
Attempting to access deeply nested values whose ancestors may not exist can cause undesirable errors. In many cases, it would be enough to know that the value is not defined. Undeep swallows these errors, returning the desired value or undefined.
Sometimes along the way we want to compute a key, e.g., the last index in an array, before continuing. Passing a key function allows us to do this. Key functions should be safe and side-effect-free; see caveats.
$ npm install --save undeep
const undeep = require('undeep');
const target = {
first: {
second: [
{ bool: true },
],
},
};
undeep(target);
// target
undeep(target, 'first');
// target.first
undeep(target, 'first', 'second', 0, 'bool', 'constructor', 'name');
// 'Boolean'
undeep(target, 'undef', 'cannot get properties of undefined');
// undefined
undeep(null, 'cannot get properties of null');
// undefined
undeep([0, 1, 2, 3, 4, 5], arr => arr.length >> 1);
// 3
Returns deep members of a target object or undefined.
Starting object to be searched. Passing a non-object will search the implicit object wrapper.
Keys to search for in order. Each returned value is searched for the following key. The function will return when keys are exhausted. If no keys are passed, the target is returned.
Keys may be computed from the preceeding value by passing a function instead of a primitive.
Because it intentionally swallows errors, undeep should be used only for retrieving data which may not be defined. Any functions passed should be side-effect-free. Be aware that simply accessing some members can have side-effects, if they involve getter functions.
Each key should be a primitive value or function. Most objects passed as keys will be interpreted as "[object Object]" and as such will return the same member (if it is defined).
Instead of undefined, underp() logs (without throwing) any error it catches along the way. Underp should only be used for debugging.
ISC © N.D.Christie
FAQs
Micro-library exposing deeply-nested members
We found that undeep 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.