This module uses Esprima to turn Angular Directive javascript source code into json format
A browserified version can be seen in the online demo
Install the module with: npm install ng-directive-parser
var ng-directive-parser = require('ng-directive-parser');
var directives = ngDirectiveParser.parseFile('directives.js');
/* Result:
[
{
"filename": "directive.js",
"name": "demoDirective1",
"replace": true,
"transclude": true,
"template": "<demo-directive2 data-action=\"foo\">Content</demo-directive2>",
"restrict": {
"A": false,
"E": true,
"C": false
}
}
]
*/
Install with cli command
$ npm install ng-directive-parser
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Copyright (c) 2014 Jan Nicklas
Licensed under the MIT license.