anno
v0.0.2
Published
A parser for embedded annotations of functions and modules
Downloads
15
Readme
Anno
A parser for embedded annotations of functions and modules
Anno parses DocBlocks, ignores any regular comment, and returns an object containing the parsed annotations.
Installation
npm install anno --save-dev
Usage
/**
* This function does something.
* @hello world
* @valueless
*/
function doSomething () {
console.log('Did something.');
}
var anno = require('anno');
var result = anno(fs.readFileSync('test.js', 'utf8'));
console.log(result);
});
{
"doSomething": {
"hello": "world",
"valueless": true
}
}
Supported syntax
function <name> (…) { … }
var <name> = function (…) { … }
let <name> = function (…) { … }
const <name> = function (…) { … }
var <name> = new Function (…)
let <name> = new Function (…)
const <name> = new Function (…)
var <name> = (…) => { … }
let <name> = (…) => { … }
const <name> = (…) => { … }
module.exports = function (…) { … }
exports.<name> = function (…) { … }
exports[<name>] = function (…) { … }
Changelog
- 0.0.2
- README fixes
- 0.0.1
- Initial version
License
Copyright (c) 2016 Thomas Rasshofer
Licensed under the MIT license.
See LICENSE for more info.