JSPM

relative-require-regex

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 408
  • Score
    100M100P100Q94920F
  • License MIT

test whether a require string is relative

Package Exports

  • relative-require-regex

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (relative-require-regex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

relative-require-regex

stable

A regex to test whether a require string is a relative path.

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.