Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reference

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reference - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

13

package.json
{
"name": "reference",
"version": "0.1.0",
"version": "0.1.1",
"description": "Generate documentation from JSON.",
"main": "reference.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"repository": {
"type": "git",
"url": "git://github.com/michellebu/reference.git"
},
"repository": "",
"author": "Michelle Bu",
"license": "BSD"
"license": "BSD",
"dependencies": {
"yaml": "~0.2.3"
}
}

@@ -6,2 +6,17 @@ # reference.js

npm install reference
## Usage
```javascript
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);
```
## Expected style

@@ -8,0 +23,0 @@

@@ -0,1 +1,3 @@

var yaml = require('yaml');
// TODO: eventually allow configurable yaml/json, html/md.

@@ -5,7 +7,14 @@ function reference(file, options) {

var components;
try {
var components = JSON.parse(file);
components = JSON.parse(file);
} catch (e) {
throw new Error('Please pass in a JSON file buffer/string.');
try {
components = yaml.eval(file);
} catch (e) {
}
}
if (!components || typeof components !== 'object') {
throw new Error('Please pass in a JSON or YAML string.');
}

@@ -12,0 +21,0 @@ return process(components, '', options.anchor);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc