Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

match-requires

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

match-requires

Match require statements in a string. Returns an array of matching require statements. Each match is an object with line number, variable name, and module name. Statements in code comments are ignored.

Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
88
-66.41%
Maintainers
1
Weekly downloads
 
Created
Source

match-requires NPM version

Match require statements in a string. Returns an array of matching require statements. Each match is an object with line number, variable name, and module name. Statements in code comments are ignored.

Install

Install with npm:

npm i match-requires --save-dev

Run tests

npm test

Usage

var re = require('match-requires');
console.log(re('require(\'a-b-c\');\nvar fooBar = require(\'foo-bar\');'))

Returns:

[ { line: 1,
    variable: '',
    module: 'a-b-c',
    original: 'require(\'a-b-c\');' },
  { line: 2,
    variable: 'fooBar',
    module: 'foo-bar',
    original: 'var fooBar = require(\'foo-bar\');' } ]

Author

Jon Schlinkert

License

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

This file was generated by verb on November 17, 2014.

Keywords

analyze

FAQs

Package last updated on 17 Nov 2014

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