Noodles Practicing Medicine
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

cmd-deps

2.3.2 • Public • Published

cmd-deps

Transform cmd and get cmd dependences

NPM Version Download Status Linux Status Windows Status Test Coverage Dependencies

Installation

npm install cmd-deps

Api

  • parseDependencies(code:String, replace:Function, flags:Boolean|Array):String
  • parseDependencies(code:String, flags:Boolean|Array):Array
    • flags means if use "require.async" like, the result should have a property "flag" of "async"
    • if flags is boolean, it will be trasform to an array inside, true -> ['async'] and false -> []

Example

source:

require('a');
//require('b');
/require('c')/;
('require("d")');
if (true) /require('e')/;
do /require('f')/.test(s);
while (false);
require.async('g');
require.async(['h']);

js:

const parseDependencies = require('cmd-deps');
const deps = parseDependencies(source, true);
 
// print dependencies
console.log(deps);

parser output:

[
  {
    flag: null,
    path: 'a'
  },
  {
    flag: 'async',
    path: 'g'
  },
  {
    flag: 'async',
    path: 'h'
  }
];

License

MIT

install

npm i cmd-deps

Downloadsweekly downloads

2

version

2.3.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability