https://github.com/nuintun/cmd-deps
Transform cmd and get cmd dependences
https://github.com/nuintun/cmd-deps
Last synced: 5 months ago
JSON representation
Transform cmd and get cmd dependences
- Host: GitHub
- URL: https://github.com/nuintun/cmd-deps
- Owner: nuintun
- License: mit
- Created: 2015-04-30T10:25:57.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-09-27T20:35:04.000Z (over 2 years ago)
- Last Synced: 2025-09-22T15:32:30.051Z (9 months ago)
- Language: JavaScript
- Homepage: http://nuintun.github.io/cmd-deps
- Size: 609 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cmd-deps
> 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]
### Installation
```
npm install cmd-deps
```
### Api
* parseDependencies(code:String|Buffer, options:Object):Object
* parseDependencies(code:String|Buffer, replace:Function, options:Object):Object
* options { acorn:Object, word:String, flags:Array }
* acorn: acorn options
* word: dependencies function name
* flags: dependencies function method name
### Example
source:
```js
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:
```js
const parseDependencies = require('cmd-deps');
const dependencies = parseDependencies(source, { flags: ['async'] }).dependencies;
// print dependencies
console.log(dependencies);
```
parser output:
```js
[
{
flag: null,
path: 'a'
},
{
flag: 'async',
path: 'g'
},
{
flag: 'async',
path: 'h'
}
];
```
## License
[MIT](LICENSE)
[travis-image]: http://img.shields.io/travis/nuintun/cmd-deps.svg?style=flat-square&label=linux
[travis-url]: https://travis-ci.org/nuintun/cmd-deps
[appveyor-image]: https://img.shields.io/appveyor/ci/nuintun/cmd-deps.svg?style=flat-square&label=windows
[appveyor-url]: https://ci.appveyor.com/project/nuintun/cmd-deps
[coveralls-image]: http://img.shields.io/coveralls/nuintun/cmd-deps/master.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/nuintun/cmd-deps?branch=master
[david-image]: http://img.shields.io/david/nuintun/cmd-deps.svg?style=flat-square
[david-url]: https://david-dm.org/nuintun/cmd-deps
[npm-image]: http://img.shields.io/npm/v/cmd-deps.svg?style=flat-square
[npm-url]: https://www.npmjs.org/package/cmd-deps
[download-image]: http://img.shields.io/npm/dm/cmd-deps.svg?style=flat-square