Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoSign 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 - npm Package Compare versions

Comparing version
0.1.1
to
0.1.2
+42
.verb.md
# {%= name %} {%= badge("fury") %}
> {%= description %}
## Install
{%= include("install") %}
## Run tests
```bash
npm test
```
## Usage
```js
var re = require('{%= name %}');
console.log(re('require(\'a-b-c\');\nvar fooBar = require(\'foo-bar\');'))
```
Returns:
```js
[ { 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
{%= include("author") %}
## License
{%= copyright() %}
{%= license() %}
***
{%= include("footer") %}
+16
-9

@@ -15,15 +15,22 @@ /*!

str = str.replace(/\r/g, '');
str = stripComments(str).split(/\n/g);
return str.reduce(function (acc, line, i) {
if (regex().exec(line)) {
acc.push({
line: i + 1,
variable: RegExp.$2,
module: RegExp.$3,
var lines = stripComments(str).split(/\n/g);
var len = lines.length;
var i = 0;
var arr = [];
var match;
while (len--) {
var line = lines[i++];
if (match = regex().exec(line)) {
arr = arr.concat({
line: i,
variable: match[2] || '',
module: match[3],
original: line
});
}
return acc;
}, []);
}
return arr;
};
{
"name": "match-requires",
"description": "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.",
"version": "0.1.1",
"version": "0.1.2",
"homepage": "https://github.com/jonschlinkert/match-requires",

@@ -6,0 +6,0 @@ "author": {

# match-requires [![NPM version](https://badge.fury.io/js/match-requires.svg)](http://badge.fury.io/js/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.
## Install
#### Install with [npm](npmjs.org):
### Install with [npm](npmjs.org):

@@ -46,3 +45,3 @@ ```bash

## License
Copyright (c) 2014 Jon Schlinkert, contributors.
Copyright (c) 2014 Jon Schlinkert
Released under the MIT license

@@ -52,2 +51,2 @@

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 20, 2014._
_This file was generated by [verb](https://github.com/assemble/verb) on November 17, 2014._
# {%= name %} {%= badge("fury") %}
> {%= description %}
## Install
{%= include("install") %}
## Run tests
```bash
npm test
```
## Usage
```js
var re = require('{%= name %}');
console.log(re('require(\'a-b-c\');\nvar fooBar = require(\'foo-bar\');'))
```
Returns:
```js
[ { 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
{%= include("author") %}
## License
{%= copyright() %}
{%= license() %}
***
{%= include("footer") %}