Socket
Socket
Sign inDemoInstall

precinct

Package Overview
Dependencies
30
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    precinct

Unleash the detectives


Version published
Weekly downloads
1.2M
decreased by-13.51%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Precinct npm npm

Unleash the detectives

npm install precinct

Uses the appropriate detective to find the dependencies of a file or its AST.

Supports:

  • JavaScript modules: AMD, CommonJS, and ES6.
  • Sass dependencies via detective-sass.
  • Stylus

Usage

var precinct = require('precinct');

var content = fs.readFileSync('myFile.js', 'utf8');

// Pass in a file's content or an AST
var deps = precinct(content);

Finding non-JavaScript (ex: Sass and Stylus) dependencies:

var content = fs.readFileSync('styles.scss', 'utf8');

var deps = precinct(content, 'sass');
var deps2 = precinct(content, 'stylus');

Or, if you just want to pass in a filepath and get the dependencies:

var paperwork = require('precinct').paperwork;

var deps = paperwork('myFile.js');
var deps2 = paperwork('styles.scss');
precinct.paperwork(filename, options)
  • includeCore: (default: true) set to false to exclude core Node dependencies from the list of dependencies.

License

MIT

Keywords

FAQs

Last updated on 04 Jul 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc