[go: up one dir, main page]

deps-regex
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

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.

Package Sidebar

Install

npm i deps-regex

Weekly Downloads

665,330

Version

0.2.0

License

MIT

Unpacked Size

6.82 kB

Total Files

5

Last publish

Collaborators

  • mathieudutour