Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Generate a simple API reference from JSON. Made specifically for PeerJS, so it probably won't suit your needs.
npm install reference
var reference = require('reference');
var fs = require('fs');
var file = fs.readFileSync('./documentation.json', {anchor: true}); // adds permalinks/anchors for all headings.
// also accepts yaml.
// Generated HTML!
var html = reference(file);
The name
property is required. Everything else is optional. Anchor IDs
will correspond to the nesting of the current property (e.g.
Some Class -> klass#method -> argument
has an ID of
some_class-klassmethod-argument
).
[
{
"name": "TopLevelClass",
"type": "constructor",
"tags": ["my", "tags"], // newly-added; doesn't show up in the pic below.
"description": "This class does some stuff.",
"snippet": "var klass = new TopLevelClass(arg1, [callback]);",
"children": [
{
"name": "arg1",
"type": "string",
"description": "This is an argument for the constructor."
},
{
"name": "callback",
"type": "function",
"description": "This is an optional callback.",
"optional": true,
"children": {
"name": "err",
"type": "error",
"description": "Will callback with an error if you messed up."
}
}
]
},
{
"name": "AnotherTopLevelClass",
"type": "constructor",
"description": "This class does some other stuff.",
"snippet": "var klass2 = new AnotherTopLevelClass(options);",
"children": {
"name": "options",
"type": "object",
"description": "This is a hash of options for AnotherTopLevelClass.",
"children": [
{
"name": "option1",
"description": "This is anything, really."
},
{
"name": "option2",
"description": "This is just really another option."
}
]
}
}
]
The above should give you something like this:
cd demo
npm install
node demo.js
FAQs
Generate documentation from JSON.
The npm package reference receives a total of 7 weekly downloads. As such, reference popularity was classified as not popular.
We found that reference 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
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.