
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
get-pkg-prop
Advanced tools
Pass a key name & get the corresponding value from the intended package.json
Pass a key name & get the corresponding value from the intended package.json
Install
npm install get-pkg-prop -S
Add to source
import { getPkgProp } from "get-pkg-prop";
Use
import { getPkgProp } from 'get-pkg-prop'
const pkgMock = { version: "1.0.0", custom: { foo: "bar", baz: "bax" } }
(async () => {
await getPkgProp("name");
// --> "get-pkg-prop"
await getPkgProp("version", "path/to/child/module");
// --> "x.y.z"
await getPkgProp("custom", pkgMock)
// --> { foo: "bar", baz: "bax" }
await getPkgProp("fakeprop");
// --> false
})
getPkgProp(szProperty)
How
package.json
.Why
import { getPkgProp } from 'get-pkg-prop'
(async () => {
await getPkgProp("name")
// --> "get-pkg-prop"
await getPkgProp("version")
// --> "0.2.6"
await getPkgProp()
// --> null; must provide property to check
await getPkgProp("xyz")
// --> false; property must exist in package.json
await getPkgProp("repository")
// --> { "type": "git", "url": "https://github.com/servexyz/get-pkg-prop" }
*/
})
getPkgProp(szProperty, oPackageJSON)
Why
import { getPkgProp } from 'get-pkg-prop'
const pkgMock = {
"name": "my-pkg",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "https://github.com/namespace/my-repo-pkg"
}
}
(async () => {
await getPkgProp("name", pkgMock)
// --> "my-pkg"
await getPkgProp("name")
// --> "get-pkg-prop"; defaults to current pkg when unspecified
await getPkgProp("version", pkgMock)
// --> "0.2.6"
await getPkgProp(, pkgMock)
// --> null; must provide property to check
await getPkgProp("xyz")
// --> false; property must exist in package.json
await getPkgProp("repository", pkgMock)
// --> { "type": "git", "url": "https://github.com/namespace/my-repo-pkg" }
await getPkgProp("repository")
// pkgMock wasn't specified, it returns value of cwd package:
// --> { "type": "git", "url": "https://github.com/servexyz/get-pkg-prop" }
})
getPkgProp(szProperty, szPathToPackageJSON)
Why
Note
import { getPkgProp } from 'get-pkg-prop'
(async () => {
await getPkgProp("name")
// --> "get-pkg-prop"; defaults to current pkg when unspecifeid
await getPkgProp("name", "path/to/child/module")
// --> "child-module-name"
await getPkgProp("version", "path/to/child/module")
// --> "x.y.z"
await getPkgProp(,"path/to/child/module")
// --> null; must provide property to check
await getPkgProp("xyz", "path/to/child/module")
// --> false; property must exist in package.json
await getPkgProp("repository", "path/to/child/module")
// --> { "type": "git", "url": "https://github.com/namespace/child-module-name" }
})
const { version } = require('./package.json')
.
get-pkg-prop("property")
without specifying package. get-pkg-prop("property", "/sub/path/to/package.json")
with package path specified.get-pkg-prop("property", myPkgObj)
return
scheme<null>
- Whenever the <string> szProperty parameter is missing<string>
- Whenever the property is found and extracted from the specified package object<false>
- Whenever the property does not exist in the specified package objectFAQs
Pass a key name & get the corresponding value from the intended package.json
The npm package get-pkg-prop receives a total of 0 weekly downloads. As such, get-pkg-prop popularity was classified as not popular.
We found that get-pkg-prop 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.