
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.
dot-values2
Advanced tools
dot-values is a collection of dot path object mutators (get-value, has-value, set-value, unset-value) with one neat addition...
const _ = require('dot-values2')
let request = {
header: {
content_type: 'application/json'
},
body: {
parts: [
{
content: '...',
featured: true
},
{
content: '!!!'
}
]
}
}
_.get(request, 'header.content_type')
// "application/json"
_.get(request, 'body.parts.1.featured')
// true
_.get(request, 'body.parts.*.content')
// ['...', '!!!']
_.has(request, 'body.parts.*.featured')
// false
// only true if all items have the attribute
_.set(request, 'body.parts.*.bool', true)
// now all parts would have an attribute bool: true
// but you can go even deeper like
_.get(request, 'body.users.*.permissions.*.name')
// ['admin', 'editor', 'publisher', 'admin' ...]
// be aware that this does not return unique values, but all the values in order
// if you want unique values though, you can do something like
// https://stackoverflow.com/questions/1960473/get-all-unique-values-in-an-array-remove-duplicates
So just to clarify, you can reference arrays of objects with an asterisk (*).
Also _.get takes a default return value as the third argument (that applies to array values too).
Otherwise everything works as the original modules.
FAQs
A set of object mutators with dot paths and one neat addition...
The npm package dot-values2 receives a total of 140 weekly downloads. As such, dot-values2 popularity was classified as not popular.
We found that dot-values2 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.