
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
get-nested-val
Advanced tools
A simple method to safely access nested values in an object.
npm i --save-dev get-nested-val
import getVal from 'get-nested-val';
Once installed, it can be used in js as
const get = getVal.get;
const result = {
books: {
chapters: [
{ title: 'Hello World!', authors: [ 'Jason fried', 'Paul Kinlan' ] },
{ title: 'JS For Beginners', authors: [ 'Yehuda Katz' ] },
{ title: 'Node For Beginners', authors: [] },
{ title: 'Software Development', authors: [ 'Martin Fowler', 'Donald Knuth', 'Linus Torvalds'] },
]
}
}
const getPosts = get(['books', 'chapters'])
console.log('=====correct======', get(['books', 'chapters', 0, 'authors'], result));
console.log('=====wrong key======', get(['books', 'chapter', 0, 'authors'], result));
console.log('=====chaining======', get(['books', 'chapters'], result).map(el => get(['authors'], el)))
console.log('=====curryd======', getPosts(result));
console.log('=====path undefined======', get(undefined, result));
console.log('=====path empty======', get([], result));
console.log('=====path String======', get('', result));
console.log('=====path object======'), get({}, result);
FAQs
Get value of an object using an array.
The npm package get-nested-val receives a total of 1 weekly downloads. As such, get-nested-val popularity was classified as not popular.
We found that get-nested-val 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.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.