underscore-docs-parser
v1.1.0
Published
Scrapes Underscore.js documentation to generate an easy to consume JSON representation.
Downloads
8
Readme
Underscore Docs Parser
CLI that scrapes Underscore.js documentation to generate an easy to consume JSON representation.
Install
npm install -g underscore-docs-parser
Usage
Output to underscore-api.json
_.docsParser -o underscore-api.json
_.docsParser --output underscore-api.json
...or, with io piping.
_.docsParser -s > underscore-api.json
_.docsParser --stream > underscore-api.json
You can optionally replace the default url to Underscore.js's html documentation.
_.docsParser -u localhost:8080/underscore-api.html -o underscore-api.json
_.docsParser --url localhost:8080/underscore-api.html --output underscore-api.json
Note: This tool will only work for the specific html written by jashkenas, and contributors, in the Underscore.js repository.
Format
string name
The Underscore.js method name (strictly top level methods).
string url
The url to the relevant Underscore.js method in the official docs.
array(string) aliases
An array of alias to the above method name. Array will be empty if there are no aliases.
array(string) arguments
An array of arguments for the method. Array will be empty if there are no arguments.
string description
The plain text description for the method (not including code samples).
Example
[
{
"name": "each",
"url": "http://underscorejs.org/#each",
"aliases": [
"forEach"
],
"arguments": [
"list",
"iteratee",
"[context]"
],
"description": "Iterates over a list of elements, yielding each in turn to an iteratee function. The iteratee is bound to the context object, if one is passed. Each invocation of iteratee is called with three arguments:(element, index, list). If list is a JavaScript object, iteratee's arguments will be (value, key, list). Returns the list for chaining."
},
...
]
Credit
Underscore.js project for the lib and documentation.
License
Copyright (c) 2015 Lochlan Bunn