requires-regex
Regular expression for matching javascript require statements.
(TOC generated by verb using markdown-toc)
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 | homepage
- match-requires: Match require statements in a string. Returns an array of matching require statements. Each match… more | homepage
- regex-cache: Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of… more | homepage
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 © 2016 Jon Schlinkert
Released under the MIT license.
This file was generated by verb on January 07, 2016.