+11
-2
@@ -60,2 +60,11 @@ // A simple implementation of make-array | ||
| // > An optional `!` or `^` at the start of a class negates it, so that it | ||
| // > matches any character not in the set. (gitignore(5), fnmatch(3)) | ||
| // The leading `^` has already been escaped to `\^` by the metacharacter | ||
| // escaper, so we strip the literal `!` or escaped `^` and emit a single | ||
| // regex `^` which is the JavaScript negation token. | ||
| const negateRange = range => range.startsWith('!') || range.startsWith('\\^') | ||
| ? `^${range.slice(range[0] === '!' ? 1 : 2)}` | ||
| : range | ||
| // See fixtures #59 | ||
@@ -165,3 +174,3 @@ const cleanRangeBackSlash = slashes => { | ||
| // Notice that the '*'s have been replaced as '\\*' | ||
| /^\^*\\\*\\\*\\\//, | ||
| /^\^*(?:\\\*\\\*\\\/)+/, | ||
@@ -277,3 +286,3 @@ // '**/foo' <-> 'foo' | ||
| // '[bar\\\\]' | ||
| ? `[${sanitizeRange(range)}${endEscape}]` | ||
| ? `[${negateRange(sanitizeRange(range))}${endEscape}]` | ||
| // Invalid range notaton | ||
@@ -280,0 +289,0 @@ // '[bar\\]' -> '[bar\\\\]' |
+11
-2
@@ -72,2 +72,11 @@ "use strict"; | ||
| // > An optional `!` or `^` at the start of a class negates it, so that it | ||
| // > matches any character not in the set. (gitignore(5), fnmatch(3)) | ||
| // The leading `^` has already been escaped to `\^` by the metacharacter | ||
| // escaper, so we strip the literal `!` or escaped `^` and emit a single | ||
| // regex `^` which is the JavaScript negation token. | ||
| var negateRange = function negateRange(range) { | ||
| return range.startsWith('!') || range.startsWith('\\^') ? "^".concat(range.slice(range[0] === '!' ? 1 : 2)) : range; | ||
| }; | ||
| // See fixtures #59 | ||
@@ -156,3 +165,3 @@ var cleanRangeBackSlash = function cleanRangeBackSlash(slashes) { | ||
| // Notice that the '*'s have been replaced as '\\*' | ||
| /^\^*\\\*\\\*\\\//, | ||
| /^\^*(?:\\\*\\\*\\\/)+/, | ||
| // '**/foo' <-> 'foo' | ||
@@ -253,3 +262,3 @@ function () { | ||
| // '[bar\\\\]' | ||
| ? "[".concat(sanitizeRange(range)).concat(endEscape, "]") // Invalid range notaton | ||
| ? "[".concat(negateRange(sanitizeRange(range))).concat(endEscape, "]") // Invalid range notaton | ||
| // '[bar\\]' -> '[bar\\\\]' | ||
@@ -256,0 +265,0 @@ : '[]' : '[]'; |
+1
-1
| { | ||
| "name": "ignore", | ||
| "version": "7.0.5", | ||
| "version": "7.0.6", | ||
| "description": "Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.", | ||
@@ -5,0 +5,0 @@ "types": "index.d.ts", |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
64428
1.65%1371
1.18%0
-100%