Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@magic/deep
Advanced tools
Work with deeply nested objects and arrays.
npm i --save --save-exact @magic/deep
// single function
import { equal, flatten, loop, merge } from '@magic/deep'
// object with all functions
import deep from '@magic/deep'
Currently implemented:
// test equality
deep.equal(['shallow', ['deep']], ['shallow', ['deep']])
// true
// alias
deep.equals, deep.eq
// test difference
deep.different(['shallow', ['deep']], ['shallow', ['deep']])
// false
// alias
deep.diff
// flatten a deeply nested array
deep.flatten(['shallow', ['deep']])
// ['shallow', 'deep']
// apply function add
const add = e => e + 1
// for each item
const items = [1, 2, [3]]
// using a deeply nested array
deep.loop(add, items)
// or
deep.loop(items, add)
// returns [2, 3, [4]]
// merge objects and arrays, with infinite recursion if needed.
// this can be slow...
deep.merge({ obj1Key: { val: 1 } }, { obj2Key: { val: 2 } } )
// { obj1Key: { val: 1}, obj2Key: { val: 2 } }
deep.merge({ key: { val: 1, str: 'test' } }, { key: { val: 2, str: 'overwritten' } })
// { key: { val: 2, str: 'overwritten' } }
use ecmascript modules instead of commonjs.
bump required node version to 14.2.0
update dependencies
update @magic/types to avoid circular dependency
...
FAQs
manipulate nested objects and arrays
The npm package @magic/deep receives a total of 339 weekly downloads. As such, @magic/deep popularity was classified as not popular.
We found that @magic/deep demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.