Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

compose-regexp

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compose-regexp - npm Package Compare versions

Comparing version 0.6.5 to 0.6.6

2

commonjs/compose-regexp.js

@@ -77,3 +77,3 @@ (function (global, factory) {

var captureMatcher = /\\[^]|\(\?[^<]|[\[\](]/g;
var captureMatcher = /\\[^]|\(\?(?::|<?[=!])|[\[\](]/g;

@@ -80,0 +80,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=yn.get(r.key,n);return null!=t?t:yn.set(r.key,n,e(r))},"name",{value:n})}function f(n){return yn.get(n,"source")||yn.set(n,"source",n.source)}function c(n){function e(n){n.lastIndex=u.lastIndex,u=n}var t,u=hn;for(xn.length=0,hn.lastIndex=0;t=u.exec(n);)if(u===hn)if("["===t[0])e(gn);else{if("."===t[0]||"[^]"===t[0]||null!=t[1]&&!un.test(r(t[1]))||null!=t[2])return!0;if(null!=t[3])xn.unshift(t[3]);else if(null!=t[4]){if(("(?="===xn[0]||"(?!"===xn[0])&&")"!==t[4])return!0;xn.shift()}}else if("]"===t[0])e(hn);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(!mn(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(wn(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=!!yn.get(n.key,"hasFinalRef"),e+=kn(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&&!yn.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(!bn.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=yn.get(n.key,"direction");if(e*Rn.current==-1)throw new TypeError("Illegal "+En[e]+" RegExp argument while building a "+En[Rn.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&&wn(e)&&yn.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)&&vn(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:yn.set(null,Object.assign({direction:L.hasRefs?Rn.current:0,isDisjunction:r&&(n.length>1||1===n.length&&n[0]instanceof Y&&yn.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 yn.set(t,yn.set(n.key,{})),yn.set(t,"source",n.source),Q.call(e,"direction")&&yn.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))):$n}function S(){return m(arguments,!1,!1,0)}function A(){return arguments.length?(y(),E(S.apply(null,arguments))):$n}function O(n,e,r,t){return function(){if(null!=r&&r(t),!arguments.length)return $n;var u=Rn.current;Rn.current=e;try{y();return E(k(S.apply(null,arguments),{open:n}),{direction:0})}finally{Rn.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(jn);if(!e||e[2]&&Number(e[2])<Number(e[1]))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 yn.set(r,{direction:Rn.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===Rn.current?A(Sn(B.apply(null,arguments)),C(1)):A(C(1),On(B.apply(null,arguments)))}function P(n,e){return A(An(e),n)}function W(n,e){return A(An(P(n,e)),n)}function z(n){return P(J&&n.unicode?Bn:/[^]/,n)}function Z(n){return R("bound"),$([In(n),Sn(n)],[On(n),An(n)])}function q(n){return R("noBound"),$([In(n),An(n)],[On(n),Sn(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=/(\\.)|[-()|\[\]]((?=\?<?[=!]))?/g,gn=/\\u(?:[0-9A-Fa-f]){4}|\\x(?:[0-9A-Fa-f]){2}|\\c[A-Za-z]|\\([^.?*+^$[\]\\(){}|\/DSWdswfnrtv-])|(\\[DSWdsw]-[^\]]|.-\\[DSWdsw])|\\.|\]/g,hn=/\\u(?:[0-9A-Fa-f]){4}|\\x(?:[0-9A-Fa-f]){2}|\\c[A-Za-z]|\\k<(.*?)>|\\([^.?*+^$[\]\\(){}|\/DSWdswBbfnrtv])|\\.|\.|\[\^\]|\[|(\((?:\?[^])?)|(\)(?:[+?*]|\{\d+,?\d*\})?)/g,yn={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]}},xn=[],kn=o("captureCount",function(n){var e,r=0;for(rn.lastIndex=0;e=rn.exec(n.source);)"("===e[0]&&(r+=1);return r}),wn=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 yn.set(n.key,"hasFinalRef",t),r}),vn=o("isDisjunction",function(n){if(-1===n.source.indexOf("|"))return!1;var e,r=0,t=!1;for(dn.lastIndex=0;e=dn.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}),mn=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(dn.lastIndex=0;r=dn.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}),bn=new RegExp("^(?:(["+G.join("")+"])(?!.*\\1))*$"),En={"-1":"backward",1:"forward"},Rn={current:1},$n=/(?:)/,Sn=O("(?=",1),An=O("(?!",1),On=O("(?<=",-1,R,"lookBehind"),In=O("(?<!",-1,R,"notBehind"),jn=/^(?:[+*?]|\{(\d+),?(\d*)\})\??$/,_n=I.call,Fn=j("?"),Cn={add:function(n){if("string"!=typeof n)throw TypeError("String expected as first argument, got "+typeof n);if(!bn.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=Sn,n.lookBehind=On,n.maybe=Fn,n.namedCapture=D,n.noBound=q,n.notAhead=An,n.notBehind=In,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=yn.get(r.key,n);return null!=t?t:yn.set(r.key,n,e(r))},"name",{value:n})}function f(n){return yn.get(n,"source")||yn.set(n,"source",n.source)}function c(n){function e(n){n.lastIndex=u.lastIndex,u=n}var t,u=hn;for(xn.length=0,hn.lastIndex=0;t=u.exec(n);)if(u===hn)if("["===t[0])e(gn);else{if("."===t[0]||"[^]"===t[0]||null!=t[1]&&!un.test(r(t[1]))||null!=t[2])return!0;if(null!=t[3])xn.unshift(t[3]);else if(null!=t[4]){if(("(?="===xn[0]||"(?!"===xn[0])&&")"!==t[4])return!0;xn.shift()}}else if("]"===t[0])e(hn);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(!mn(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(wn(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=!!yn.get(n.key,"hasFinalRef"),e+=kn(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&&!yn.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(!bn.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=yn.get(n.key,"direction");if(e*Rn.current==-1)throw new TypeError("Illegal "+En[e]+" RegExp argument while building a "+En[Rn.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&&wn(e)&&yn.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)&&vn(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:yn.set(null,Object.assign({direction:L.hasRefs?Rn.current:0,isDisjunction:r&&(n.length>1||1===n.length&&n[0]instanceof Y&&yn.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 yn.set(t,yn.set(n.key,{})),yn.set(t,"source",n.source),Q.call(e,"direction")&&yn.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))):$n}function S(){return m(arguments,!1,!1,0)}function A(){return arguments.length?(y(),E(S.apply(null,arguments))):$n}function O(n,e,r,t){return function(){if(null!=r&&r(t),!arguments.length)return $n;var u=Rn.current;Rn.current=e;try{y();return E(k(S.apply(null,arguments),{open:n}),{direction:0})}finally{Rn.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(jn);if(!e||e[2]&&Number(e[2])<Number(e[1]))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 yn.set(r,{direction:Rn.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===Rn.current?A(Sn(B.apply(null,arguments)),C(1)):A(C(1),On(B.apply(null,arguments)))}function P(n,e){return A(An(e),n)}function W(n,e){return A(An(P(n,e)),n)}function z(n){return P(J&&n.unicode?Bn:/[^]/,n)}function Z(n){return R("bound"),$([In(n),Sn(n)],[On(n),An(n)])}function q(n){return R("noBound"),$([In(n),An(n)],[On(n),Sn(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=/(\\.)|[-()|\[\]]((?=\?<?[=!]))?/g,gn=/\\u(?:[0-9A-Fa-f]){4}|\\x(?:[0-9A-Fa-f]){2}|\\c[A-Za-z]|\\([^.?*+^$[\]\\(){}|\/DSWdswfnrtv-])|(\\[DSWdsw]-[^\]]|.-\\[DSWdsw])|\\.|\]/g,hn=/\\u(?:[0-9A-Fa-f]){4}|\\x(?:[0-9A-Fa-f]){2}|\\c[A-Za-z]|\\k<(.*?)>|\\([^.?*+^$[\]\\(){}|\/DSWdswBbfnrtv])|\\.|\.|\[\^\]|\[|(\((?:\?[^])?)|(\)(?:[+?*]|\{\d+,?\d*\})?)/g,yn={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]}},xn=[],kn=o("captureCount",function(n){var e,r=0;for(rn.lastIndex=0;e=rn.exec(n.source);)"("===e[0]&&(r+=1);return r}),wn=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 yn.set(n.key,"hasFinalRef",t),r}),vn=o("isDisjunction",function(n){if(-1===n.source.indexOf("|"))return!1;var e,r=0,t=!1;for(dn.lastIndex=0;e=dn.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}),mn=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(dn.lastIndex=0;r=dn.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}),bn=new RegExp("^(?:(["+G.join("")+"])(?!.*\\1))*$"),En={"-1":"backward",1:"forward"},Rn={current:1},$n=/(?:)/,Sn=O("(?=",1),An=O("(?!",1),On=O("(?<=",-1,R,"lookBehind"),In=O("(?<!",-1,R,"notBehind"),jn=/^(?:[+*?]|\{(\d+),?(\d*)\})\??$/,_n=I.call,Fn=j("?"),Cn={add:function(n){if("string"!=typeof n)throw TypeError("String expected as first argument, got "+typeof n);if(!bn.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=Sn,n.lookBehind=On,n.maybe=Fn,n.namedCapture=D,n.noBound=q,n.notAhead=An,n.notBehind=In,n.ref=C,n.sequence=A,n.suffix=j,Object.defineProperty(n,"__esModule",{value:!0})});
{
"name": "compose-regexp",
"version": "0.6.5",
"version": "0.6.6",
"description": "A set of functions to build and compose complex regular expressions",

@@ -43,3 +43,3 @@ "type": "module",

"devDependencies": {
"compose-regexp": "0.6.4",
"compose-regexp": "0.6.5",
"gosub": "1.0.0",

@@ -46,0 +46,0 @@ "ospec": "^4.1.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc