Small utility to read/write Angular module creation calls.
var ngParseModule = require('ng-parse-module');
//read module from file
var results = ngParseModule('app.js');
//update module dependencies and rewrite
results.dependencies.modules.push('newDependency');
results.save();
Parses the file and returns an object the following properties:
file
- Name of the file parsed.name
- Name of the Angular module.dependencies
- Object containingstart
,end
, andmodules
properties.contents
- Contents of the file parsed.save
- Function that will rewrite the parsed file with any changes thedependencies.modules
property reflected in the new source.