0.0.2 • Published 8 years ago

anno v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Anno

A parser for embedded annotations of functions and modules

Build Status Coverage Status Dependency Status Dependency Status

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.

0.0.2

8 years ago

0.0.1

8 years ago