🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

detective-es6

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detective-es6

Get the dependencies of an ES6 module

latest
Source
npmnpm
Version
5.0.2
Version published
Weekly downloads
4.3M
0.58%
Maintainers
3
Weekly downloads
 
Created
Source

detective-es6

CI npm version npm downloads

Get the dependencies of an ES6 module

npm install detective-es6

Usage

const fs = require('fs');
const detective = require('detective-es6');

const mySourceCode = fs.readFileSync('myfile.js', 'utf8');

// Pass in a file's content or an AST
const dependencies = detective(mySourceCode);
  • Supports JSX, Flow, and any other features that node-source-walk supports.

You may also (optionally) configure the detective via a second object argument detective(src, options) that supports the following options:

  • skipTypeImports: (Boolean) whether or not to omit type imports (import type {foo} from "mylib";) in the list of extracted dependencies.
  • skipAsyncImports: (Boolean) whether or not to omit async imports (import('foo')) in the list of extracted dependencies.

License

MIT

Keywords

detective

FAQs

Package last updated on 20 Apr 2026

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