Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

requires-regex

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requires-regex

Regular expression for matching javascript require statements.

  • 0.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
decreased by-20.43%
Maintainers
1
Weekly downloads
 
Created
Source

requires-regex NPM version Build Status

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 foo = require(\'bar\')',
//   'foo',
//   'bar',
//   index: 0,
//   input: '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));
//=> [ 'var path = require(\'path\')', 'var foo = require(\'bar\')' ]

re().test('require(\'foo\');');
//=> true
  • 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.

Keywords

FAQs

Package last updated on 08 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc