ng-mod-get-names
v1.0.0
Published
Get module names from an Angular file's contents
Downloads
16
Readme
ng-mod-get-names
Get module names from an Angular file's contents
Install
npm install --save ng-mod-get-names
Usage
ES2015
import fs from 'fs';
import ngModGetNames from 'ng-mod-get-names';
// file.js
// angular.module('app', ['ngRoute']);
// angular
// .module('test')
// .service(....);
const jsFileContents = fs.readFileSync('file.js');
ngModGetNames(jsFileContents);
// => ['app', 'test'];
// file.coffee
// angular.module 'app', ['ngRoute']
// angular
// .module 'test'
// .service ....
const coffeeFileContents = fs.readFileSync('file.js');
ngModGetNames(coffeeFileContents);
// => ['app', 'test'];
ES5
var fs = require('fs');
var ngModGetNames = require('ng-mod-get-names');
// file.js
// angular.module('app', ['ngRoute']);
// angular
// .module('test')
// .service(....);
var jsFileContents = fs.readFileSync('file.js');
ngModGetNames(jsFileContents);
// => ['app', 'test'];
// file.coffee
// angular.module 'app', ['ngRoute']
// angular
// .module 'test'
// .service ....
var coffeeFileContents = fs.readFileSync('file.js');
ngModGetNames(coffeeFileContents);
// => ['app', 'test'];
API
ngModGetNames(fileContents)
fileContents
Type: string
File contents to analyze for module names.
LICENSE
MIT © Dustin Specker