Generate docs from javascript source via AST parsing
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Brett Langdon d0b37e439f add install and basic usage to readme 11 years ago
lib make sure to handle if statements 11 years ago
test make sure to handle if statements 11 years ago
.gitignore initial commit 11 years ago
.travis.yml add travis-yml 11 years ago
LICENSE initial commit 11 years ago
README.md add install and basic usage to readme 11 years ago
package.json add basic tests 11 years ago

README.md

DocAST

Build Status

DocAST is tool to help parse docs strings + additional properties from your javascript source code.

Install

NPM

npm install docast

git

git clone git://github.com/brettlangdon/docast.git
cd ./docast
npm install

Basic Usage

The below example shows how you can use DocAST to parse documentation data from your javascript source code.

example.js

/*
 * This function is super cool and does all sorts of cool stuffs
 */
function some(cool, stuff){
    if(typeof cool === undefined || typeof stuff === undefined){
        throw new Exception('must provide "cool" or "stuff" parameter');
    }

    if(cool > stuff){
        return stuff;
    } else if(stuff > cool){
        return cool;
    } else {
        return null;
    };
}

Usage

var docast = require('docast');
var comments = docast.parse('./example.js');
// this is the result
comments = [ { name: 'some',
               params: [ 'cool', 'stuff' ],
               returns: [ 'stuff', 'cool', null ],
               raises: [ 'Exception' ],
               doc: ' This function is super cool and does all sorts of cool stuffs\n ' } ]