compose-regexp
Advanced tools
Comparing version 0.6.20 to 0.6.21
# Change Log | ||
## v0.6.21 | ||
*2022-05-08* | ||
### Bug fixes | ||
- Actually fix the last bug... | ||
## v0.6.20 | ||
@@ -4,0 +12,0 @@ |
@@ -107,3 +107,3 @@ (function (global, factory) { | ||
var suffixMatcher = /^(?:[+*?]|\{(?=((\d+),?(\d*)))\1\})\??$/; | ||
var suffixMatcher = /^(?:[+*?]|\{(?=((\d+)))\1,?(\d*)\})\??$/; | ||
@@ -110,0 +110,0 @@ |
/**@license MIT-compose-regexp.js-©Pierre-Yves Gérardy*/ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("compose-regexp",["exports"],e):(n="undefined"!=typeof globalThis?globalThis:n||self,e(n.composeRegexp={}))}(this,function(n){"use strict";function e(n){return n}function r(n){return-1===n.indexOf("\\")?n:JSON.parse('"'+n.replace(/$|"|\\x([\dA-Fa-f]{2})|\\u\{([\dA-Fa-f]{1,6})\}/g,function(n,e,r){return""===n?'"':'"'===n?'\\"':String.fromCodePoint(parseInt(e||r,16))}))}function t(){return"_"+Math.floor(Math.random()*Math.pow(2,32)).toString(36)}function u(){return{captureCount:null,direction:0,hasRefs:null,hasFinalRef:null,isDisjunction:null,isOneGroupOrAssertion:null,source:null,unicode:null}}function i(n){if(n instanceof Y){var e=en.get(n);return null==e&&en.set(n,e=u()),e}return n||u()}function o(n,e){return Object.defineProperty(function(r){var t=xn.get(r.key,n);return null!=t?t:xn.set(r.key,n,e(r))},"name",{value:n})}function f(n){return xn.get(n,"source")||xn.set(n,"source",n.source)}function c(n){function e(n){n.lastIndex=u.lastIndex,u=n}var t,u=yn;for(kn.length=0,yn.lastIndex=0;t=u.exec(n);)if(u===yn)if("["===t[0])e(hn);else{if("."===t[0]||"[^]"===t[0]||null!=t[1]&&!un.test(r(t[1]))||null!=t[2])return!0;if(null!=t[3])kn.unshift(t[3]);else if(null!=t[4]){if(("(?="===kn[0]||"(?!"===kn[0])&&")"!==t[4])return!0;kn.shift()}}else if("]"===t[0])e(yn);else if(null!=t[1]||null!=t[2])return!0;return!1}function l(n){var e=n.source;if(null==e||"^"===e||"$"===e||"\\b"===e||"\\B"===e)throw new SyntaxError("Nothing to repeat: /"+(e||"(?:)")+"/");if(1===e.length||sn.test(e)||K.U&&an.test(e))return!1;if(!bn(n))return!0;if(/^\(\?<?[!=]/.test(e))throw new SyntaxError("Nothing to repeat: /"+e+"/");return!1}function s(n){var e=!1;return n.replace(on,function(n,r){if("]"===n){if(!e)return"\\]";e=!1}else if(!e&&null!=r){if("["!==r)return"\\"+r;e=!0}return n})}function a(n){var e=n;return function(n){if("regexp"===n.kind||"result"===n.kind){if(vn(n)){L.hasRefs=!0;var r=!1;n.source=n.source.replace(ln,function(n,t,u,i){if(!r){if(null!=t){var o=Number(t)+e;if(o>99)throw new RangeError("Too many back references");return"\\"+String(o)}if(null!=u)return"0"===u?"\\"+String(i):"$d:"+(Number(u)-1)+",n:"+i+"^"}return"["===n?r=!0:"]"===n&&(r=!1),n})}L.hasFinalRef=!!xn.get(n.key,"hasFinalRef"),e+=wn(n)}return L.captureCount=e,n}}function p(n){var e=n.source;if(K.U&&("regexp"===n.kind&&!n.key.unicode||"result"===n.kind&&!xn.get(n.key,"unicode"))){if(c(e))throw new SyntaxError("Can't upgrade the RegExp to Unicode /"+e+"/"+("regexp"===n.kind?n.key.flags:""));n.source=s(e)}var r=!1;return"regexp"===n.kind&&(n.key.dotAll||n.key.multiline)&&(n.source=e.replace(tn,function(e){return r?("]"===e&&(r=!1),e):("["===e&&(r=!0),n.key.dotAll&&"."===e?"[^]":n.key.multiline&&"^"===e&&H?cn.source:n.key.multiline&&"$"===e&&H?fn.source:e)})),n}function d(n){var e=n.key.flags;if(!En.test(e))throw new TypeError("Unkown flags: "+e.replace(new RegExp("["+G.join()+"]","g"),""));var r=!!n.key.unicode,t=n.key.ignoreCase,u=n.key.multiline;if(null!=K.I&&t!==K.I)throw new SyntaxError("Can't combine i and non-i regexps: "+n.key);if(!H&&null!=K.M&&u!==K.M)throw new SyntaxError("Can't combine m and non-m regexps: "+n.key);return K.I=t,K.M=u,K.U=K.U||r,n}function g(n){var e=xn.get(n.key,"direction");if(e*$n.current==-1)throw new TypeError("Illegal "+Rn[e]+" RegExp argument while building a "+Rn[$n.current]+" one: /"+n.source+"/");return 0!==e&&(L.hasRefs=!0),n}function h(n){return n?function(n,e){return n.source=null==n.source?e.source:e.source+"|"+n.source,n}:function(n,e){return n.source=null==n.source?e.source:e.source+("string"!==e.kind&&vn(e)&&xn.get(e.key,"hasFinalRef")&&/^\d/.test(n.source)?"(?:)":"")+n.source,n}}function y(){L={hasRefs:!1,hasFinalRef:!1,captureCount:0},K={U:!1,I:null,M:null}}function x(n){var e=L,r=K;try{return n()}finally{L=e,K=r}}function k(n,e){return e.condition&&!e.condition(n)||(n.source=e.open+(n.source||"")+")"),e.suffix&&(n.source+=e.suffix),n}function w(n){return k(n,{condition:function(n){return("regexp"===n.kind||"result"===n.kind)&&mn(n)},open:"(?:"})}function v(n){if("number"==typeof n||"string"==typeof n)return{key:null,kind:"string",source:String(n).replace(pn,"\\$&")};throw new TypeError("Can't compose type "+typeof n+" as RegExp")}function m(n,r,t,u){return t=t||n.length>1,V.call(n,function n(u){return(!r&&t?w:e)(Array.isArray(u)?m(u,!1,t,0):"function"==typeof u?n(x(u)):u instanceof Y?g(d({key:u,kind:"regexp",source:f(u)})):v(u))}).map(p).map(a(u)).reduceRight(h(r),{key:xn.set(null,Object.assign({direction:L.hasRefs?$n.current:0,isDisjunction:r&&(n.length>1||1===n.length&&n[0]instanceof Y&&xn.get(n[0],"isDisjunction")),unicode:K.U},L)),kind:"result",source:null})}function b(){return(K.I?"i":"")+(H?"":K.M?"m":"")+(K.U?"u":"")}function E(n,e){e=e||{};var r=Q.call(e,"flags")?e.flagsOp(b(),e.flags):b(),t=new RegExp(n.source||"",r);return xn.set(t,xn.set(n.key,{})),xn.set(t,"source",n.source),Q.call(e,"direction")&&xn.set(t,"direction",e.direction),t}function R(n){if(!H)throw new Error("no support for /(?<=...)/ which is required by "+n+"()")}function $(){return arguments.length?(y(),E(m(arguments,!0,!1,0))):Sn}function S(){return m(arguments,!1,!1,0)}function A(){return arguments.length?(y(),E(S.apply(null,arguments))):Sn}function O(n,e,r,t){return function(){if(null!=r&&r(t),!arguments.length)return Sn;var u=$n.current;$n.current=e;try{y();return E(k(S.apply(null,arguments),{open:n}),{direction:0})}finally{$n.current=u}}}function I(){return y(),E(k(_n.apply(S,arguments),{condition:l,open:"(?:",suffix:this}))}function j(n){"string"!=typeof n&&(n="{"+String(n)+"}");var e=n.match(dn);if(!e||e[3]&&Number(e[3])<Number(e[2]))throw new SyntaxError("Invalid suffix '"+n+"'.");return 1===arguments.length?I.bind(n,n):I.apply(n,arguments)}function _(n){return!J||un.test(r(n))}function F(n){var e=typeof n;return"string"===e&&_(n)||"number"===e&&0<n&&Math.round(n)===n}function C(n,e){if(!F(n))throw new SyntaxError("Bad ref: "+n);if(null!=e&&("number"!=typeof e||e<1||e!==e|0))throw new RangeError("Bad depth: "+e);if("string"==typeof n)return new RegExp("\\k<"+n+">");var r=new RegExp("$d:"+(e||"0")+",n:"+n+"^");return xn.set(r,{direction:$n.current,hasFinalRef:!0,hasRefs:!0}),r}function B(){return y(),E(k(m(arguments,!1,!1,1),{open:"("}))}function M(n){if("string"!=typeof n)throw new TypeError("String expected, got "+typeof n);return _(n),y(),E(k(m(X.call(arguments,1),!1,!1,1),{open:"(?<"+n+">"}))}function D(n){return 1===arguments.length?M.bind(null,n):M.apply(null,arguments)}function U(n,e){return n=n.split(""),e.split("").forEach(function(e){-1===n.indexOf(e)&&n.push(e)}),n.sort().join("")}function T(n){return y(),-1!==n.indexOf("u")&&(K.U=!0),E(_n.apply(S,arguments),{flagsOp:this,flags:n})}function N(){return 1===$n.current?A(An(B.apply(null,arguments)),C(1)):A(C(1),In(B.apply(null,arguments)))}function P(n,e){return A(On(e),n)}function W(n,e){return A(An(e),n)}function z(n){return P(J&&n.unicode?Bn:/[^]/,n)}function Z(n){return R("bound"),$([jn(n),An(n)],[In(n),On(n)])}function q(n){return R("noBound"),$([jn(n),On(n)],[In(n),An(n)])}var G=[];"dgimsuy".split("").forEach(function(n){try{new RegExp("",n),G.push(n)}catch(n){}});var J=-1!==G.indexOf("u"),H=!1;try{new RegExp("(?<=)"),H=!0}catch(n){}var K,L,Q={}.hasOwnProperty,V=[].map,X=[].slice,Y=RegExp,nn={value:void 0,writable:!1,enumerable:!1,configurable:!1},en={key:"__$$__compose_regexp__$$__"+t()+t()+t()+t(),set:function(n,e){var r=typeof n;if(null==n||"object"!==r&&"function"!==r)throw new TypeError("Bad WeakMap key");var t=n[en.key];if(!t)return nn.value={keys:[this],values:[e]},Object.defineProperty(n,en.key,nn),this;var u=t.keys.indexOf(this);return 0===u?(t.keys.push(this),t.values.push(e),this):(t.values[u]=e,this)},get:function(n){var e=n[en.key];if(e){var r=e.keys.indexOf(this);if(-1!==r)return e.values[r]}}},rn=/\\[^]|\(\?(?::|<?[=!])|[\[\](]/g,tn=/\\.|\.|\(\?:\^\|\(\?<=\[\\n\\r\\u2028\\u2029\]\)\)|\(\?:\$\|\(\?=\[\\n\\r\\u2028\\u2029\]\)\)|\[|\]|\^|\$/g,un=J&&new RegExp("^[_$\\p{ID_Start}][$\\p{ID_Continue}]*$","u"),on=/\\.|\{\d+,?\d*\}|(\[|\]|\{|\})/g,fn=/(?:$|(?=[\n\r\u2028\u2029]))/,cn=/(?:^|(?<=[\n\r\u2028\u2029]))/,ln=/\\[^1-9]|[\[\]]|\\(\d{1,2})|\$d:(\d+),n:(\d+)\^/g,sn=/^(?:\\.|\[(?=((?:\\.|.)*?))\1\])$/,an=/^\\p\{[A-Za-z][A-Za-z=]*\}$/,pn=/[.?*+^$[\]\\(){}|]/g,dn=/^(?:[+*?]|\{(?=((\d+),?(\d*)))\1\})\??$/,gn=/(\\.)|[-()|\[\]]((?=\?<?[=!]))?/g,hn=/\\u(?:[0-9A-Fa-f]){4}|\\x(?:[0-9A-Fa-f]){2}|\\c[A-Za-z]|\\([^.?*+^$[\]\\(){}|\/DSWdswfnrtv-])|(\\[DSWdsw]-[^\]]|.-\\[DSWdsw])|\\.|\]/g,yn=/\\u(?:[0-9A-Fa-f]){4}|\\x(?:[0-9A-Fa-f]){2}|\\c[A-Za-z]|\\k<(.*?)>|\\([^.?*+^$[\]\\(){}|\/DSWdswBbfnrtv])|\\.|\.|\[\^\]|\[|(\((?:\?[^])?)|(\)(?:[+?*]|\{\d+,?\d*\})?)/g,xn={set:function(n,e,r){var t=i(n);return"object"==typeof e?Object.assign(t,e):t[e]=r},get:function(n,e){return i(n)[e]}},kn=[],wn=o("captureCount",function(n){var e,r=0;for(rn.lastIndex=0;e=rn.exec(n.source);)"("===e[0]&&(r+=1);return r}),vn=o("hasRefs",function(n){var e,r=!1,t=!1,u=!1;for(ln.lastIndex=0;e=ln.exec(n.source);)u||null==e[1]&&null==e[2]?"["===e[0]?u=!0:"]"===e[0]&&(u=!1):(r=!0,ln.lastIndex===n.source.length&&(t=!0));return xn.set(n.key,"hasFinalRef",t),r}),mn=o("isDisjunction",function(n){if(-1===n.source.indexOf("|"))return!1;var e,r=0,t=!1;for(gn.lastIndex=0;e=gn.exec(n.source);)if(null==e[1]&&(t||"("!==e[0]||r++,t||")"!==e[0]||r--,t||"["!==e[0]&&"[-"!==e[0]||(t=!0),t&&"]"===e[0]&&(t=!1),0===r&&!t&&"|"===e[0]))return!0;return!1}),bn=o("isOneGroupOrAssertion",function(n){var e=n.source;if("("!==e.charAt(0)||")"!==e.charAt(e.length-1))return!1;var r,t=0,u=!1;for(gn.lastIndex=0;r=gn.exec(e);)if(null==r[1]){if(u||"("!==r[0]||t++,!u&&")"===r[0]&&0===--t&&r.index!==e.length-1)return!1;u||"["!==r[0]&&"[-"!==r||(u=!0),u&&"]"===r[0]&&(u=!1)}else if(r.index===e.length-2)return!1;return!0}),En=new RegExp("^(?:(["+G.join("")+"])(?!.*\\1))*$"),Rn={"-1":"backward",1:"forward"},$n={current:1},Sn=/(?:)/,An=O("(?=",1),On=O("(?!",1),In=O("(?<=",-1,R,"lookBehind"),jn=O("(?<!",-1,R,"notBehind"),_n=I.call,Fn=j("?"),Cn={add:function(n){if("string"!=typeof n)throw TypeError("String expected as first argument, got "+typeof n);if(!En.test(n))throw new SyntaxError("Invalid flags: "+n);return 1===arguments.length?T.bind(U,n):T.apply(U,arguments)}},Bn=J&&new RegExp("[^]","u"),Mn={difference:P,intersection:W,complement:z,union:$};n.atomic=N,n.bound=Z,n.capture=B,n.charSet=Mn,n.either=$,n.flags=Cn,n.lookAhead=An,n.lookBehind=In,n.maybe=Fn,n.namedCapture=D,n.noBound=q,n.notAhead=On,n.notBehind=jn,n.ref=C,n.sequence=A,n.suffix=j,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("compose-regexp",["exports"],e):(n="undefined"!=typeof globalThis?globalThis:n||self,e(n.composeRegexp={}))}(this,function(n){"use strict";function e(n){return n}function r(n){return-1===n.indexOf("\\")?n:JSON.parse('"'+n.replace(/$|"|\\x([\dA-Fa-f]{2})|\\u\{([\dA-Fa-f]{1,6})\}/g,function(n,e,r){return""===n?'"':'"'===n?'\\"':String.fromCodePoint(parseInt(e||r,16))}))}function t(){return"_"+Math.floor(Math.random()*Math.pow(2,32)).toString(36)}function u(){return{captureCount:null,direction:0,hasRefs:null,hasFinalRef:null,isDisjunction:null,isOneGroupOrAssertion:null,source:null,unicode:null}}function i(n){if(n instanceof Y){var e=en.get(n);return null==e&&en.set(n,e=u()),e}return n||u()}function o(n,e){return Object.defineProperty(function(r){var t=xn.get(r.key,n);return null!=t?t:xn.set(r.key,n,e(r))},"name",{value:n})}function f(n){return xn.get(n,"source")||xn.set(n,"source",n.source)}function c(n){function e(n){n.lastIndex=u.lastIndex,u=n}var t,u=yn;for(kn.length=0,yn.lastIndex=0;t=u.exec(n);)if(u===yn)if("["===t[0])e(hn);else{if("."===t[0]||"[^]"===t[0]||null!=t[1]&&!un.test(r(t[1]))||null!=t[2])return!0;if(null!=t[3])kn.unshift(t[3]);else if(null!=t[4]){if(("(?="===kn[0]||"(?!"===kn[0])&&")"!==t[4])return!0;kn.shift()}}else if("]"===t[0])e(yn);else if(null!=t[1]||null!=t[2])return!0;return!1}function l(n){var e=n.source;if(null==e||"^"===e||"$"===e||"\\b"===e||"\\B"===e)throw new SyntaxError("Nothing to repeat: /"+(e||"(?:)")+"/");if(1===e.length||sn.test(e)||K.U&&an.test(e))return!1;if(!bn(n))return!0;if(/^\(\?<?[!=]/.test(e))throw new SyntaxError("Nothing to repeat: /"+e+"/");return!1}function s(n){var e=!1;return n.replace(on,function(n,r){if("]"===n){if(!e)return"\\]";e=!1}else if(!e&&null!=r){if("["!==r)return"\\"+r;e=!0}return n})}function a(n){var e=n;return function(n){if("regexp"===n.kind||"result"===n.kind){if(vn(n)){L.hasRefs=!0;var r=!1;n.source=n.source.replace(ln,function(n,t,u,i){if(!r){if(null!=t){var o=Number(t)+e;if(o>99)throw new RangeError("Too many back references");return"\\"+String(o)}if(null!=u)return"0"===u?"\\"+String(i):"$d:"+(Number(u)-1)+",n:"+i+"^"}return"["===n?r=!0:"]"===n&&(r=!1),n})}L.hasFinalRef=!!xn.get(n.key,"hasFinalRef"),e+=wn(n)}return L.captureCount=e,n}}function p(n){var e=n.source;if(K.U&&("regexp"===n.kind&&!n.key.unicode||"result"===n.kind&&!xn.get(n.key,"unicode"))){if(c(e))throw new SyntaxError("Can't upgrade the RegExp to Unicode /"+e+"/"+("regexp"===n.kind?n.key.flags:""));n.source=s(e)}var r=!1;return"regexp"===n.kind&&(n.key.dotAll||n.key.multiline)&&(n.source=e.replace(tn,function(e){return r?("]"===e&&(r=!1),e):("["===e&&(r=!0),n.key.dotAll&&"."===e?"[^]":n.key.multiline&&"^"===e&&H?cn.source:n.key.multiline&&"$"===e&&H?fn.source:e)})),n}function d(n){var e=n.key.flags;if(!En.test(e))throw new TypeError("Unkown flags: "+e.replace(new RegExp("["+G.join()+"]","g"),""));var r=!!n.key.unicode,t=n.key.ignoreCase,u=n.key.multiline;if(null!=K.I&&t!==K.I)throw new SyntaxError("Can't combine i and non-i regexps: "+n.key);if(!H&&null!=K.M&&u!==K.M)throw new SyntaxError("Can't combine m and non-m regexps: "+n.key);return K.I=t,K.M=u,K.U=K.U||r,n}function g(n){var e=xn.get(n.key,"direction");if(e*$n.current==-1)throw new TypeError("Illegal "+Rn[e]+" RegExp argument while building a "+Rn[$n.current]+" one: /"+n.source+"/");return 0!==e&&(L.hasRefs=!0),n}function h(n){return n?function(n,e){return n.source=null==n.source?e.source:e.source+"|"+n.source,n}:function(n,e){return n.source=null==n.source?e.source:e.source+("string"!==e.kind&&vn(e)&&xn.get(e.key,"hasFinalRef")&&/^\d/.test(n.source)?"(?:)":"")+n.source,n}}function y(){L={hasRefs:!1,hasFinalRef:!1,captureCount:0},K={U:!1,I:null,M:null}}function x(n){var e=L,r=K;try{return n()}finally{L=e,K=r}}function k(n,e){return e.condition&&!e.condition(n)||(n.source=e.open+(n.source||"")+")"),e.suffix&&(n.source+=e.suffix),n}function w(n){return k(n,{condition:function(n){return("regexp"===n.kind||"result"===n.kind)&&mn(n)},open:"(?:"})}function v(n){if("number"==typeof n||"string"==typeof n)return{key:null,kind:"string",source:String(n).replace(pn,"\\$&")};throw new TypeError("Can't compose type "+typeof n+" as RegExp")}function m(n,r,t,u){return t=t||n.length>1,V.call(n,function n(u){return(!r&&t?w:e)(Array.isArray(u)?m(u,!1,t,0):"function"==typeof u?n(x(u)):u instanceof Y?g(d({key:u,kind:"regexp",source:f(u)})):v(u))}).map(p).map(a(u)).reduceRight(h(r),{key:xn.set(null,Object.assign({direction:L.hasRefs?$n.current:0,isDisjunction:r&&(n.length>1||1===n.length&&n[0]instanceof Y&&xn.get(n[0],"isDisjunction")),unicode:K.U},L)),kind:"result",source:null})}function b(){return(K.I?"i":"")+(H?"":K.M?"m":"")+(K.U?"u":"")}function E(n,e){e=e||{};var r=Q.call(e,"flags")?e.flagsOp(b(),e.flags):b(),t=new RegExp(n.source||"",r);return xn.set(t,xn.set(n.key,{})),xn.set(t,"source",n.source),Q.call(e,"direction")&&xn.set(t,"direction",e.direction),t}function R(n){if(!H)throw new Error("no support for /(?<=...)/ which is required by "+n+"()")}function $(){return arguments.length?(y(),E(m(arguments,!0,!1,0))):Sn}function S(){return m(arguments,!1,!1,0)}function A(){return arguments.length?(y(),E(S.apply(null,arguments))):Sn}function O(n,e,r,t){return function(){if(null!=r&&r(t),!arguments.length)return Sn;var u=$n.current;$n.current=e;try{y();return E(k(S.apply(null,arguments),{open:n}),{direction:0})}finally{$n.current=u}}}function I(){return y(),E(k(_n.apply(S,arguments),{condition:l,open:"(?:",suffix:this}))}function j(n){"string"!=typeof n&&(n="{"+String(n)+"}");var e=n.match(dn);if(!e||e[3]&&Number(e[3])<Number(e[2]))throw new SyntaxError("Invalid suffix '"+n+"'.");return 1===arguments.length?I.bind(n,n):I.apply(n,arguments)}function _(n){return!J||un.test(r(n))}function F(n){var e=typeof n;return"string"===e&&_(n)||"number"===e&&0<n&&Math.round(n)===n}function C(n,e){if(!F(n))throw new SyntaxError("Bad ref: "+n);if(null!=e&&("number"!=typeof e||e<1||e!==e|0))throw new RangeError("Bad depth: "+e);if("string"==typeof n)return new RegExp("\\k<"+n+">");var r=new RegExp("$d:"+(e||"0")+",n:"+n+"^");return xn.set(r,{direction:$n.current,hasFinalRef:!0,hasRefs:!0}),r}function B(){return y(),E(k(m(arguments,!1,!1,1),{open:"("}))}function M(n){if("string"!=typeof n)throw new TypeError("String expected, got "+typeof n);return _(n),y(),E(k(m(X.call(arguments,1),!1,!1,1),{open:"(?<"+n+">"}))}function D(n){return 1===arguments.length?M.bind(null,n):M.apply(null,arguments)}function U(n,e){return n=n.split(""),e.split("").forEach(function(e){-1===n.indexOf(e)&&n.push(e)}),n.sort().join("")}function T(n){return y(),-1!==n.indexOf("u")&&(K.U=!0),E(_n.apply(S,arguments),{flagsOp:this,flags:n})}function N(){return 1===$n.current?A(An(B.apply(null,arguments)),C(1)):A(C(1),In(B.apply(null,arguments)))}function P(n,e){return A(On(e),n)}function W(n,e){return A(An(e),n)}function z(n){return P(J&&n.unicode?Bn:/[^]/,n)}function Z(n){return R("bound"),$([jn(n),An(n)],[In(n),On(n)])}function q(n){return R("noBound"),$([jn(n),On(n)],[In(n),An(n)])}var G=[];"dgimsuy".split("").forEach(function(n){try{new RegExp("",n),G.push(n)}catch(n){}});var J=-1!==G.indexOf("u"),H=!1;try{new RegExp("(?<=)"),H=!0}catch(n){}var K,L,Q={}.hasOwnProperty,V=[].map,X=[].slice,Y=RegExp,nn={value:void 0,writable:!1,enumerable:!1,configurable:!1},en={key:"__$$__compose_regexp__$$__"+t()+t()+t()+t(),set:function(n,e){var r=typeof n;if(null==n||"object"!==r&&"function"!==r)throw new TypeError("Bad WeakMap key");var t=n[en.key];if(!t)return nn.value={keys:[this],values:[e]},Object.defineProperty(n,en.key,nn),this;var u=t.keys.indexOf(this);return 0===u?(t.keys.push(this),t.values.push(e),this):(t.values[u]=e,this)},get:function(n){var e=n[en.key];if(e){var r=e.keys.indexOf(this);if(-1!==r)return e.values[r]}}},rn=/\\[^]|\(\?(?::|<?[=!])|[\[\](]/g,tn=/\\.|\.|\(\?:\^\|\(\?<=\[\\n\\r\\u2028\\u2029\]\)\)|\(\?:\$\|\(\?=\[\\n\\r\\u2028\\u2029\]\)\)|\[|\]|\^|\$/g,un=J&&new RegExp("^[_$\\p{ID_Start}][$\\p{ID_Continue}]*$","u"),on=/\\.|\{\d+,?\d*\}|(\[|\]|\{|\})/g,fn=/(?:$|(?=[\n\r\u2028\u2029]))/,cn=/(?:^|(?<=[\n\r\u2028\u2029]))/,ln=/\\[^1-9]|[\[\]]|\\(\d{1,2})|\$d:(\d+),n:(\d+)\^/g,sn=/^(?:\\.|\[(?=((?:\\.|.)*?))\1\])$/,an=/^\\p\{[A-Za-z][A-Za-z=]*\}$/,pn=/[.?*+^$[\]\\(){}|]/g,dn=/^(?:[+*?]|\{(?=((\d+)))\1,?(\d*)\})\??$/,gn=/(\\.)|[-()|\[\]]((?=\?<?[=!]))?/g,hn=/\\u(?:[0-9A-Fa-f]){4}|\\x(?:[0-9A-Fa-f]){2}|\\c[A-Za-z]|\\([^.?*+^$[\]\\(){}|\/DSWdswfnrtv-])|(\\[DSWdsw]-[^\]]|.-\\[DSWdsw])|\\.|\]/g,yn=/\\u(?:[0-9A-Fa-f]){4}|\\x(?:[0-9A-Fa-f]){2}|\\c[A-Za-z]|\\k<(.*?)>|\\([^.?*+^$[\]\\(){}|\/DSWdswBbfnrtv])|\\.|\.|\[\^\]|\[|(\((?:\?[^])?)|(\)(?:[+?*]|\{\d+,?\d*\})?)/g,xn={set:function(n,e,r){var t=i(n);return"object"==typeof e?Object.assign(t,e):t[e]=r},get:function(n,e){return i(n)[e]}},kn=[],wn=o("captureCount",function(n){var e,r=0;for(rn.lastIndex=0;e=rn.exec(n.source);)"("===e[0]&&(r+=1);return r}),vn=o("hasRefs",function(n){var e,r=!1,t=!1,u=!1;for(ln.lastIndex=0;e=ln.exec(n.source);)u||null==e[1]&&null==e[2]?"["===e[0]?u=!0:"]"===e[0]&&(u=!1):(r=!0,ln.lastIndex===n.source.length&&(t=!0));return xn.set(n.key,"hasFinalRef",t),r}),mn=o("isDisjunction",function(n){if(-1===n.source.indexOf("|"))return!1;var e,r=0,t=!1;for(gn.lastIndex=0;e=gn.exec(n.source);)if(null==e[1]&&(t||"("!==e[0]||r++,t||")"!==e[0]||r--,t||"["!==e[0]&&"[-"!==e[0]||(t=!0),t&&"]"===e[0]&&(t=!1),0===r&&!t&&"|"===e[0]))return!0;return!1}),bn=o("isOneGroupOrAssertion",function(n){var e=n.source;if("("!==e.charAt(0)||")"!==e.charAt(e.length-1))return!1;var r,t=0,u=!1;for(gn.lastIndex=0;r=gn.exec(e);)if(null==r[1]){if(u||"("!==r[0]||t++,!u&&")"===r[0]&&0===--t&&r.index!==e.length-1)return!1;u||"["!==r[0]&&"[-"!==r||(u=!0),u&&"]"===r[0]&&(u=!1)}else if(r.index===e.length-2)return!1;return!0}),En=new RegExp("^(?:(["+G.join("")+"])(?!.*\\1))*$"),Rn={"-1":"backward",1:"forward"},$n={current:1},Sn=/(?:)/,An=O("(?=",1),On=O("(?!",1),In=O("(?<=",-1,R,"lookBehind"),jn=O("(?<!",-1,R,"notBehind"),_n=I.call,Fn=j("?"),Cn={add:function(n){if("string"!=typeof n)throw TypeError("String expected as first argument, got "+typeof n);if(!En.test(n))throw new SyntaxError("Invalid flags: "+n);return 1===arguments.length?T.bind(U,n):T.apply(U,arguments)}},Bn=J&&new RegExp("[^]","u"),Mn={difference:P,intersection:W,complement:z,union:$};n.atomic=N,n.bound=Z,n.capture=B,n.charSet=Mn,n.either=$,n.flags=Cn,n.lookAhead=An,n.lookBehind=In,n.maybe=Fn,n.namedCapture=D,n.noBound=q,n.notAhead=On,n.notBehind=jn,n.ref=C,n.sequence=A,n.suffix=j,Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "compose-regexp", | ||
"version": "0.6.20", | ||
"version": "0.6.21", | ||
"description": "A set of functions to build and compose complex regular expressions", | ||
@@ -48,3 +48,3 @@ "type": "module", | ||
"devDependencies": { | ||
"compose-regexp": "0.6.19", | ||
"compose-regexp": "0.6.20", | ||
"gosub": "1.1.0", | ||
@@ -51,0 +51,0 @@ "ospec": "^4.1.1", |
@@ -66,3 +66,3 @@ import {atomic, capture, either, flags, lookAhead, maybe, sequence, suffix} from '../node_modules/compose-regexp/compose-regexp.js' | ||
/[+*?]/, | ||
['{', atomic(/(\d+),?(\d*)/), '}'] | ||
['{', atomic(/(\d+)/),/,?(\d*)/, '}'] | ||
), | ||
@@ -69,0 +69,0 @@ maybe('?') |
@@ -50,3 +50,3 @@ // /!\ DO NOT EDIT MANUALLY /!\ | ||
var suffixMatcher = /^(?:[+*?]|\{(?=((\d+),?(\d*)))\1\})\??$/ | ||
var suffixMatcher = /^(?:[+*?]|\{(?=((\d+)))\1,?(\d*)\})\??$/ | ||
@@ -53,0 +53,0 @@ |
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
170897