Socket
Socket
Sign inDemoInstall

deps-regex

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    deps-regex

Regular expression for matching javascript require/import statements.


Version published
Weekly downloads
638K
decreased by-24.77%
Maintainers
1
Install size
7.51 kB
Created
Weekly downloads
 

Changelog

Source

0.2.0

  • Include typescript definition

Readme

Source

deps-regex

Regular expression for matching javascript require/import statements.

This is pretty fragile and created for perf reasons where using a real parser would be overkill.

Install

Install with npm

npm install --save deps-regex

Usage

var DepsRegex = require("deps-regex");
var re = new DepsRegex({
  matchInternal: true,
  matchES6: true,
  matchCoffeescript: true,
});

re.getDependencies("var foo = require('bar');");
// => [ 'bar']

Known false positives

module.exports = 'require("false-positive");';

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running tests

Install dev dependencies:

npm install && npm test

License

Released under the MIT license.

Keywords

FAQs

Last updated on 28 Sep 2021

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