Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cmd-deps

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmd-deps

Transform cmd and get cmd dependences.

  • 3.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

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|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:

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 dependencies = parseDependencies(source, { flags: ['async'] }).dependencies;

// print dependencies
console.log(dependencies);

parser output:

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

License

MIT

Keywords

FAQs

Package last updated on 27 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc