Regular expression for matching javascript require/import statements.
npm install 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 with npm
``sh`
npm install --save deps-regex
`js
var DepsRegex = require("deps-regex");
var re = new DepsRegex({
matchInternal: true,
matchES6: true,
matchCoffeescript: true,
});
re.getDependencies("var foo = require('bar');");
// => [ 'bar']
`
`js`
module.exports = 'require("false-positive");';
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Install dev dependencies:
`sh``
npm install && npm test
Released under the MIT license.