Comparing version 2.2.2 to 2.2.3
{ | ||
"name": "cmd-deps", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "Transform cmd and get cmd dependences", | ||
@@ -5,0 +5,0 @@ "author": { |
# cmd-deps | ||
>Transform cmd and get cmd dependences | ||
> Transform cmd and get cmd dependences | ||
> | ||
>[![NPM Version][npm-image]][npm-url] | ||
>[![Download Status][download-image]][npm-url] | ||
>[![Linux Status][travis-image]][travis-url] | ||
>[![Windows Status][appveyor-image]][appveyor-url] | ||
>[![Test Coverage][coveralls-image]][coveralls-url] | ||
>[![Dependencies][david-image]][david-url] | ||
> [![NPM Version][npm-image]][npm-url] | ||
> [![Download Status][download-image]][npm-url] | ||
> [![Linux Status][travis-image]][travis-url] | ||
> [![Windows Status][appveyor-image]][appveyor-url] | ||
> [![Test Coverage][coveralls-image]][coveralls-url] | ||
> [![Dependencies][david-image]][david-url] | ||
### Installation | ||
``` | ||
@@ -18,9 +19,12 @@ 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 -> []``` | ||
* if flags is boolean, it will be trasform to an array inside, `true -> ['async']` and `false -> []` | ||
### Example | ||
source: | ||
```js | ||
@@ -30,5 +34,6 @@ require('a'); | ||
/require('c')/; | ||
'require("d")'; | ||
if(true)/require('e')/; | ||
do /require('f')/.test(s); while(false); | ||
('require("d")'); | ||
if (true) /require('e')/; | ||
do /require('f')/.test(s); | ||
while (false); | ||
require.async('g'); | ||
@@ -39,2 +44,3 @@ require.async(['h']); | ||
js: | ||
```js | ||
@@ -49,17 +55,18 @@ var parseDependencies = require('cmd-deps'); | ||
parser output: | ||
```js | ||
[ | ||
{ | ||
"flag": null, | ||
"path": "a" | ||
flag: null, | ||
path: 'a' | ||
}, | ||
{ | ||
"flag": 'async', | ||
"path": "g" | ||
flag: 'async', | ||
path: 'g' | ||
}, | ||
{ | ||
"flag": 'async', | ||
"path": "h" | ||
flag: 'async', | ||
path: 'h' | ||
} | ||
] | ||
]; | ||
``` | ||
@@ -66,0 +73,0 @@ |
85
10498