JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1099472
  • Score
    100M100P100Q195196F
  • License MIT

Regular expression for matching javascript require/import statements.

Package Exports

  • deps-regex

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (deps-regex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.