Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1.11 KB

README.md

File metadata and controls

52 lines (36 loc) · 1.11 KB

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.