Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
deep-pick-omit
Advanced tools
Deep-pick and deep-omit objects with typesafe paths.
Both deepPick
and deepOmit
take an object and an array of dot-notation paths to respectively pick and omit from the object. By default, TypeScript will infer types for paths and error if a path does not exist in the object.
deepPick
import { deepPick } from 'deep-pick-omit'
const obj = {
a: {
b: 'this',
c: 'not this'
},
d: 'this'
}
deepPick(obj, ['a.b', 'e'])
// -> { a: { b: 'this' }, d: 'this' }
deepPick(obj, ['f'])
// -> TypeScript Error: `f` is not a key of `obj`
deepOmit
import { deepOmit } from 'deep-pick-omit'
const obj = {
a: {
b: 'this',
c: 'not this'
},
d: 'this'
}
deepOmit(obj, ['a.c'])
// -> { a: { b: 'this' }, d: 'this' }
deepOmit(obj, ['f'])
// -> TypeScript Error: `f` is not a key of `obj`
[!NOTE] Pathing through array values is not allowed typesafe path methods. See unsafe methods.
If paths type-safety is a problem for some edge cases, the package exposes the same methods without the type-checking on paths.
deepPickUnsafe
import { deepPickUnsafe } from 'deep-pick-omit'
const obj = {
a: {
c: 'not this'
},
d: 'this'
}
deepPickUnsafe(obj, ['d', 'f'])
// -> { d: 'this' }
deepOmitUnsafe
import { deepOmitUnsafe } from 'deep-pick-omit'
const obj = {
a: {
b: 'this',
c: 'not this'
},
d: 'this'
}
deepOmitUnsafe(obj, ['a.c', 'f'])
// -> { a: { b: 'this' }, d: 'this' }
MIT — Made with 💖.
v1.2.1
FAQs
Deep-pick and deep-omit objects with typesafe paths.
The npm package deep-pick-omit receives a total of 75,409 weekly downloads. As such, deep-pick-omit popularity was classified as popular.
We found that deep-pick-omit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.