Skip to content

mattdesl/relative-require-regex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

relative-require-regex

stable

A regex to test whether a require string is a system path (relative or absolute). Module lookups like "url" will return false.

var relative = require('relative-require-regex')()

relative.test('url')            => false
relative.test('is-array')       => false
relative.test('xtend/mutable')  => false

relative.test('./foo')          => true
relative.test('../foo')         => true
relative.test('/home/index.js') => true

Usage

NPM

reg = relative()

Returns a new regex that tests whether the require path is relative or not, according to Node's resolve algorithm.

License

MIT, see LICENSE.md for details.

About

test whether a require string is relative

Resources

License

Stars

Watchers

Forks

Packages

No packages published