wildcard-match
Advanced tools
Comparing version 5.1.3 to 5.1.4
@@ -91,3 +91,8 @@ 'use strict'; | ||
if (currentSeparator) { | ||
result += s === 0 ? '' : currentSeparator; | ||
result += | ||
s === 0 | ||
? '' | ||
: s === segments.length - 1 | ||
? "(?:".concat(requiredSeparator, "|$)") | ||
: requiredSeparator; | ||
result += "(?:".concat(wildcard, "*?").concat(currentSeparator, ")*?"); | ||
@@ -94,0 +99,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).wcmatch=e()}(this,(function(){"use strict";function t(t){return"-"===t||"^"===t||"$"===t||"+"===t||"."===t||"("===t||")"===t||"|"===t||"["===t||"]"===t||"{"===t||"}"===t||"*"===t||"?"===t||"\\"===t?"\\".concat(t):t}function e(n,r){if(void 0===r&&(r=!0),Array.isArray(n)){var o=n.map((function(t){return"^".concat(e(t,r),"$")}));return"(?:".concat(o.join("|"),")")}var a="",i="",c=".";!0===r?(a="/",i="[/\\\\]",c="[^/\\\\]"):r&&(i=function(e){for(var n="",r=0;r<e.length;r++)n+=t(e[r]);return n}(a=r),i.length>1?(i="(?:".concat(i,")"),c="((?!".concat(i,").)")):c="[^".concat(i,"]"));for(var s=r?"".concat(i,"+?"):"",f=r?"".concat(i,"*?"):"",u=r?n.split(a):[n],p="",g=0;g<u.length;g++){var l=u[g],y=u[g+1],h="";if(l||!(g>0))if(r&&(h=g===u.length-1?f:"**"!==y?s:""),r&&"**"===l)h&&(p+=0===g?"":h,p+="(?:".concat(c,"*?").concat(h,")*?"));else{for(var d=0;d<l.length;d++){var b=l[d];"\\"===b?d<l.length-1&&(p+=t(l[d+1]),d++):p+="?"===b?c:"*"===b?"".concat(c,"*?"):t(b)}p+=h}}return p}function n(t,e){if("string"!=typeof e)throw new TypeError("Sample must be a string, but ".concat(typeof e," given"));return t.test(e)}return function(t,r){if("string"!=typeof t&&!Array.isArray(t))throw new TypeError("The first argument must be a single pattern string or an array of patterns, but ".concat(typeof t," given"));if("string"!=typeof r&&"boolean"!=typeof r||(r={separator:r}),2===arguments.length&&void 0!==r&&("object"!=typeof r||null===r||Array.isArray(r)))throw new TypeError("The second argument must be an options object or a string/boolean separator, but ".concat(typeof r," given"));if("\\"===(r=r||{}).separator)throw new Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");var o=e(t,r.separator),a=new RegExp("^".concat(o,"$"),r.flags),i=n.bind(null,a);return i.options=r,i.pattern=t,i.regexp=a,i}})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).wcmatch=e()}(this,(function(){"use strict";function t(t){return"-"===t||"^"===t||"$"===t||"+"===t||"."===t||"("===t||")"===t||"|"===t||"["===t||"]"===t||"{"===t||"}"===t||"*"===t||"?"===t||"\\"===t?"\\".concat(t):t}function e(n,r){if(void 0===r&&(r=!0),Array.isArray(n)){var o=n.map((function(t){return"^".concat(e(t,r),"$")}));return"(?:".concat(o.join("|"),")")}var a="",i="",c=".";!0===r?(a="/",i="[/\\\\]",c="[^/\\\\]"):r&&(i=function(e){for(var n="",r=0;r<e.length;r++)n+=t(e[r]);return n}(a=r),i.length>1?(i="(?:".concat(i,")"),c="((?!".concat(i,").)")):c="[^".concat(i,"]"));for(var s=r?"".concat(i,"+?"):"",f=r?"".concat(i,"*?"):"",u=r?n.split(a):[n],p="",g=0;g<u.length;g++){var l=u[g],y=u[g+1],h="";if(l||!(g>0))if(r&&(h=g===u.length-1?f:"**"!==y?s:""),r&&"**"===l)h&&(p+=0===g?"":g===u.length-1?"(?:".concat(s,"|$)"):s,p+="(?:".concat(c,"*?").concat(h,")*?"));else{for(var d=0;d<l.length;d++){var b=l[d];"\\"===b?d<l.length-1&&(p+=t(l[d+1]),d++):p+="?"===b?c:"*"===b?"".concat(c,"*?"):t(b)}p+=h}}return p}function n(t,e){if("string"!=typeof e)throw new TypeError("Sample must be a string, but ".concat(typeof e," given"));return t.test(e)}return function(t,r){if("string"!=typeof t&&!Array.isArray(t))throw new TypeError("The first argument must be a single pattern string or an array of patterns, but ".concat(typeof t," given"));if("string"!=typeof r&&"boolean"!=typeof r||(r={separator:r}),2===arguments.length&&void 0!==r&&("object"!=typeof r||null===r||Array.isArray(r)))throw new TypeError("The second argument must be an options object or a string/boolean separator, but ".concat(typeof r," given"));if("\\"===(r=r||{}).separator)throw new Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");var o=e(t,r.separator),a=new RegExp("^".concat(o,"$"),r.flags),i=n.bind(null,a);return i.options=r,i.pattern=t,i.regexp=a,i}})); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "wildcard-match", | ||
"version": "5.1.3", | ||
"version": "5.1.4", | ||
"description": "A tiny and extremely fast library for compiling and matching basic glob patterns", | ||
@@ -15,2 +15,3 @@ "author": "Alex Schneider <me@schneider.ax>", | ||
], | ||
"packageManager": "yarn@1.22.22", | ||
"type": "commonjs", | ||
@@ -52,6 +53,6 @@ "main": "build/index.js", | ||
"matcher": "^4.0.0", | ||
"picomatch": "^2.3.1", | ||
"picomatch": "^4.0.2", | ||
"prettier": "^2.8.8", | ||
"pta": "^0.2.3", | ||
"rollup": "^2.79.1", | ||
"rollup": "^2.79.2", | ||
"rollup-plugin-cleanup": "^3.2.1", | ||
@@ -58,0 +59,0 @@ "rollup-plugin-delete": "^2.0.0", |
@@ -69,3 +69,3 @@ <br> | ||
<td align="center">🔌</td> | ||
<td><strong>Compatible</strong><br>Works in any ES5+ environment including older versions of Node.js, Deno, React Native and browsers</td> | ||
<td><strong>Compatible</strong><br>Works in any ES5+ environment including older versions of Node.js, Bun, Deno, React Native and browsers</td> | ||
</tr> | ||
@@ -279,2 +279,3 @@ </table> | ||
``` | ||
Node.js v22 | ||
Pattern: src/test/**/*.?s | ||
@@ -284,10 +285,8 @@ Sample: src/test/foo/bar.js | ||
Compilation | ||
wildcard-match 1,046,326 ops/sec | ||
picomatch 261,589 ops/sec | ||
wildcard-match v5.1.4 1,000,947 ops/sec | ||
picomatch v4.0.2 216,903 ops/sec | ||
Matching | ||
wildcard-match 34,646,993 ops/sec | ||
picomatch 10,750,888 ops/sec | ||
wildcard-match v5.1.4 24,330,069 ops/sec | ||
picomatch v4.0.2 7,776,730 ops/sec | ||
``` | ||
A better comparison is in the works. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64360
464
290