requires-regex
Regular expressions for matching javascript require statements.
Install
Install with npm
$ npm i requires-regex --save
Usage
var re = require('requires-regex');
re().exec('var foo = require(\'bar\');');
var str = ' var path = require(\'path\');\n\nvar foo = require(\'bar\');';
var regex = new RegExp(re().source, 'gm');
console.log(str.match(regex));
re().test('require(\'foo\');');
Related projects
- lint-deps: CLI tool that tells you when dependencies are missing from package.json and offers you a… more
- match-requires: Match require statements in a string. Returns an array of matching require statements. Each match… more
- regex-cache: Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of… more
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
This file was generated by verb-cli on August 19, 2015.