ng-mod-get-names

1.0.0 • Public • Published

ng-mod-get-names

NPM version Build Status Coverage Status

Code Climate Dependencies DevDependencies

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    2

Package Sidebar

Install

npm i ng-mod-get-names

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • dustinspecker