Skip to content

Regular expressions for matching node.js require statements.

License

Notifications You must be signed in to change notification settings

regexhq/requires-regex

 
 

Repository files navigation

requires-regex NPM version

Regular expressions for matching node.js require statements.

Install

Install with npm

npm i requires-regex --save

Run tests

npm test

Usage

var re = require('requires-regex');

re().exec('var isDir = require(\'is-directory\');');
//=>
// [ 'var isDir = require(\'is-directory\')',
//   'var isDir = ',
//   'isDir',
//   'is-directory',
//   index: 0,
//   input: 'var isDir = require(\'is-directory\');' ]

'var path = require(\'path\');\nvar list = require(\'dirs\');'.match(re());
//=> [ 'var path = require(\'path\')', 'var list = require(\'dirs\')' ]

re().test('require(\'foo\');');
//=> true

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on September 20, 2014.

About

Regular expressions for matching node.js require statements.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%