🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

regexp-support

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regexp-support - npm Package Compare versions

Comparing version

to
1.0.6

@@ -37,2 +37,6 @@ /**

namedCapturingGroupsEmoji: boolean;
lookAheadPositive: boolean;
lookAheadNegative: boolean;
lookBehindPositive: boolean;
lookBehindNegative: boolean;
};

@@ -39,0 +43,0 @@ }>;

@@ -9,2 +9,6 @@ /**

namedCapturingGroupsEmoji: boolean;
lookAheadPositive: boolean;
lookAheadNegative: boolean;
lookBehindPositive: boolean;
lookBehindNegative: boolean;
};

@@ -11,0 +15,0 @@ export declare const PatternTest: {

@@ -10,2 +10,6 @@ "use strict";

namedCapturingGroupsEmoji: false,
lookAheadPositive: false,
lookAheadNegative: false,
lookBehindPositive: false,
lookBehindNegative: false,
};

@@ -31,2 +35,20 @@ exports.PatternTest = {

],
lookAheadPositive: [
['aa(?=bb)', '', 'aabb', true, 'test'],
],
lookAheadNegative: [
['aa(?!bb)', '', 'aabb', false, 'test'],
],
lookBehindPositive: [
['(?<=\\$)foo', 'g', '$foo %foo foo', '$ %foo foo', 'replace'],
['(?<=\\$)foo', 'g', '$foo %foo foo', '$bar %foo foo', function (r, value, input, pattern, RegExpClass, flag) {
return input.replace(r, 'bar') === value;
}],
],
lookBehindNegative: [
['(?<!\\$)foo', 'g', '$foo %foo foo', '$foo % ', 'replace'],
['(?<!\\$)foo', 'g', '$foo %foo foo', '$foo %bar bar', function (r, value, input, pattern, RegExpClass, flag) {
return input.replace(r, 'bar') === value;
}],
],
};

@@ -53,3 +75,12 @@ // @ts-ignore

else {
bool = r[fn](input) === value;
let ret;
switch (fn) {
case 'replace':
ret = input.replace(r, '');
bool = ret === value;
break;
default:
bool = r[fn](input) === value;
break;
}
}

@@ -56,0 +87,0 @@ }

@@ -11,2 +11,8 @@ /**

namedCapturingGroupsEmoji: false,
lookAheadPositive: false,
lookAheadNegative: false,
lookBehindPositive: false,
lookBehindNegative: false,
};

@@ -35,2 +41,26 @@

],
lookAheadPositive: [
['aa(?=bb)', '', 'aabb', true, 'test'],
],
lookAheadNegative: [
['aa(?!bb)', '', 'aabb', false, 'test'],
],
lookBehindPositive: [
['(?<=\\$)foo', 'g', '$foo %foo foo', '$ %foo foo', 'replace'],
['(?<=\\$)foo', 'g', '$foo %foo foo', '$bar %foo foo', function <T>(r: RegExp, value: any, input: string, pattern: string, RegExpClass: ITypeCreateRegExp<T>, flag: string)
{
return input.replace(r, 'bar') === value;
}],
],
lookBehindNegative: [
['(?<!\\$)foo', 'g', '$foo %foo foo', '$foo % ', 'replace'],
['(?<!\\$)foo', 'g', '$foo %foo foo', '$foo %bar bar', function <T>(r: RegExp, value: any, input: string, pattern: string, RegExpClass: ITypeCreateRegExp<T>, flag: string)
{
return input.replace(r, 'bar') === value;
}],
],
};

@@ -78,3 +108,16 @@

{
bool = r[fn](input) === value;
let ret;
switch (fn)
{
case 'replace':
ret = input.replace(r, '');
bool = ret === value;
break;
default:
bool = r[fn](input) === value;
break;
}
}

@@ -81,0 +124,0 @@ }

{
"name": "regexp-support",
"version": "1.0.5",
"version": "1.0.6",
"description": "check RegExp ( regular expressions ) support",

@@ -8,2 +8,3 @@ "keywords": [

"es2018",
"esnext",
"flag",

@@ -10,0 +11,0 @@ "flags",

@@ -37,2 +37,27 @@ # regexp-support

### desc
#### lookAheadPositive, lookAheadNegative
* `aa(?=bb)`
* `aa(?!bb)`
#### lookBehindPositive
* `(?<=\$)foo`
```ts
const RE_DOLLAR_PREFIX = /(?<=\\$)foo/g;
'$foo %foo foo'.replace(RE_DOLLAR_PREFIX, 'bar'); // => '$bar %foo foo'
```
#### lookBehindNegative
* `(?<!\$)foo`
```ts
const RE_NO_DOLLAR_PREFIX = /(?<!\\$)foo/g;
'$foo %foo foo'.replace(RE_NO_DOLLAR_PREFIX, 'bar'); // => '$foo %bar bar'
```
### node.js 10

@@ -61,3 +86,7 @@

namedCapturingGroupsUnicode: true,
namedCapturingGroupsEmoji: false } }
namedCapturingGroupsEmoji: false,
lookAheadPositive: true,
lookAheadNegative: true,
lookBehindPositive: true,
lookBehindNegative: true } }
```

@@ -64,0 +93,0 @@