Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
This module will take paths in documents which can include nested paths specified by '.'s and can evaluate the path to a value, or can set the value at that path depending on the function called.
$ npm install doc-path
var path = require('doc-path');
document
- Object
- A JSON document that will be iterated over.key
- String
- A path to the existing key whose value will be returned.If the key does not exist, null
is returned.
var path = require('doc-path');
var document = {
Make: 'Nissan',
Model: 'Murano',
Year: '2013',
Specifications: {
Mileage: '7106',
Trim: 'S AWD'
}
};
console.log(path.evaluatePath(document, 'Make'));
// => 'Nissan'
console.log(path.evaluatePath(document, 'Specifications.Mileage'));
// => '7106'
document
- Object
- A JSON document that will be iterated over.key
- String
- A path to the existing key whose value will be set.value
- *
- The value that will be set at the given key.If the key does not exist, then the object will be built up to have that path. If no document is provided, an error will be thrown.
var path = require('doc-path');
var document = {
Make: 'Nissan'
};
console.log(path.setPath(document, 'Color.Interior', 'Tan'));
// => { Make: 'Nissan', Color: { Interior: 'Tan' } }
console.log(path.setPath(document, 'StockNumber', '34567'));
// => { Make: 'Nissan', Color: { Interior: 'Tan' }, StockNumber: '34567' }
$ npm test
Note: This requires mocha
, should
, async
, and underscore
.
To see test coverage, please run:
$ npm run coverage
Current Coverage is:
Statements : 100% ( 22/22 )
Branches : 90% ( 9/10 )
Functions : 100% ( 2/2 )
Lines : 100% ( 19/19 )
FAQs
A document path library for Node
The npm package doc-path receives a total of 357,723 weekly downloads. As such, doc-path popularity was classified as popular.
We found that doc-path demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.