is-regexp-x
Version:
Is this value a JS regex?
15 lines • 18.7 kB
JavaScript
/*!
{
"author": "Graham Fairweather",
"copywrite": "Copyright (c) 2017",
"date": "2019-08-28T17:34:53.334Z",
"describe": "",
"description": "Is this value a JS regex?",
"file": "is-regexp-x.min.js",
"hash": "1eb1976731908c98e043",
"license": "MIT",
"version": "3.1.2"
}
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.isRegexpX=e():t.isRegexpX=e()}(function(){"use strict";var t,e={}.constructor,n=e.prototype,r=e.defineProperty,o=function(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0},i=function(){return this};try{return r?r(n,"$$globalThis$$",{get:i,configurable:!0}):n.__defineGetter__("$$globalThis$$",i),t="undefined"==typeof $$globalThis$$?o():$$globalThis$$,delete n.$$globalThis$$,t}catch(t){return o()}}(),function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=6)}([function(t,e,n){"use strict";var r=Object.prototype.toString;if(n(3)()){var o=Symbol.prototype.toString,i=/^Symbol\(.*\)$/;t.exports=function(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==r.call(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&i.test(o.call(t))}(t)}catch(t){return!1}}}else t.exports=function(t){return!1}},function(t,e,n){"use strict";var r=String.prototype.valueOf,o=Object.prototype.toString,i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"string"==typeof t||"object"==typeof t&&(i?function(t){try{return r.call(t),!0}catch(t){return!1}}(t):"[object String]"===o.call(t))}},function(t,e,n){"use strict";var r=Date.prototype.getDay,o=Object.prototype.toString,i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"object"==typeof t&&null!==t&&(i?function(t){try{return r.call(t),!0}catch(t){return!1}}(t):"[object Date]"===o.call(t))}},function(t,e,n){"use strict";(function(e){var r=e.Symbol,o=n(5);t.exports=function(){return"function"==typeof r&&("function"==typeof Symbol&&("symbol"==typeof r("foo")&&("symbol"==typeof Symbol("bar")&&o())))}}).call(this,n(4))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),n=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}n.r(e);var o=function(t){return"object"===r(t)?null===t:"function"!=typeof t},i=n(1),u=n.n(i),c={}.constructor("a"),s="a"===c[0]&&0 in c,f=function(){}.bind,a="function"==typeof f&&function(){var t=null,e=null,n=null,r=[];try{var o=f.apply(function(r,o){return n=this,t=r,e=o,arguments},[r,1]),i=o(2);return 1===o.length&&2===i.length&&1===t&&2===e&&n===r}catch(t){return!1}}()&&function(){var t=null,e=null,n=null,r=[1,2,3],o=function(o,i){return t=o,e=i,n=this,r};try{var i=f.apply(o,[null]),u=new i(1,2);return i.length===o.length&&u===r&&1===t&&2===e&&n!==r}catch(t){return!1}}(),l="".split,p=Math.max,y=o.bind,b=o.call,d=a?y.call(b,l):function(t,e){return l.call(t,e)},v=function(t){return u()(t)?d(t,""):t},g=function(t,e){var n=arguments.length>2?arguments[2]:[];if("string"!=typeof t&&o(t))return n;for(var r=s?t:v(t),i=r.length,u=p(0,e)||0;u<i;u+=1)n[n.length]=t[u];return n};function m(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(r=(u=c.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var h=g.bind,w=g.call,S={},_=S.constructor,j=S.toString,O=function(t,e){return t>=e?t:e},x=function(t){if("function"!=typeof t&&"[object Function]"!==j.apply(t))throw new TypeError("bind called on incompatible "+t)},T=[function(t){return function(){return t.apply(this,g(arguments))}},function(t,e){return function(n){return t.apply(this,g(arguments,e,[n]))}},function(t,e){return function(n,r){return t.apply(this,g(arguments,e,[n,r]))}},function(t,e){return function(n,r,o){return t.apply(this,g(arguments,e,[n,r,o]))}},function(t,e){return function(n,r,o,i){return t.apply(this,g(arguments,e,[n,r,o,i]))}},function(t,e){return function(n,r,o,i,u){return t.apply(this,g(arguments,e,[n,r,o,i,u]))}},function(t,e){return function(n,r,o,i,u,c){return t.apply(this,g(arguments,e,[n,r,o,i,u,c]))}},function(t,e){return function(n,r,o,i,u,c,s){return t.apply(this,g(arguments,e,[n,r,o,i,u,c,s]))}},function(t,e){return function(n,r,o,i,u,c,s,f){return t.apply(this,g(arguments,e,[n,r,o,i,u,c,s,f]))}}],E=function(t){var e=m(t,3),n=e[0],r=e[1],o=e[2],i=O(0,r.length-O(0,o.length-2)),u=T[i],c=u?u(n,i):T[0](n);if(r.prototype){var s=function(){};s.prototype=r.prototype,c.prototype=new s,s.prototype=null}return c},$=function(t,e){var n=t.apply(this,e);return _(n)===n?n:this},P=a?w.bind(h):function(t,e){x(t);var n,r=arguments,o=function(){var o=g(arguments,0,g(r,2));return this instanceof n?$.apply(this,[t,o]):t.apply(e,o)};return n=E([o,t,r])},F=TypeError,M=P.apply,k=P(P.call,M),N=P(M,{}.toString),I=function(t){if("function"!=typeof t&&"[object Function]"!==N(t))throw new F(t+" is not a function");return t},C=function(t,e){return k(I(t),e,g(arguments[2]))},G=function(t){try{return{threw:!1,value:C(t,this,g(arguments,1))}}catch(t){return{threw:!0,value:t}}},D=function(t){return!!t},A={}.toString,R=function(t){return function(t){if("function"!=typeof t&&"[object Function]"!==C(A,t))throw new TypeError("methodize called on incompatible "+t)}(t),function(){return C(t,arguments[0],g(arguments,1))}},X=R({}.toString),q=function(t){return null===t?"[object Null]":void 0===t?"[object Undefined]":X(t)},L=n(0),z=n.n(L);for(var B=G(function(){return function(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}(this,void 0),"function"==typeof Symbol&&z()(Symbol(""))}.bind(void 0)),H=!1===B.threw&&!0===B.value,U=H&&z()(Symbol.toStringTag),V=function(t){return null==t},J=function(t){if(V(t))throw new TypeError("Cannot call method on ".concat(t));return t},K="Cannot convert a Symbol value to a string".constructor,Q=function(t){if(z()(t))throw new TypeError("Cannot convert a Symbol value to a string");return K(t)},W=function(t){return Q(J(t))},Y=[{code:9,description:"Tab",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\t"},{code:10,description:"Line Feed",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\n"},{code:11,description:"Vertical Tab",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\v"},{code:12,description:"Form Feed",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\f"},{code:13,description:"Carriage Return",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\r"},{code:32,description:"Space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:160,description:"No-break space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:5760,description:"Ogham space mark",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:6158,description:"Mongolian vowel separator",es5:!0,es2015:!0,es2016:!0,es2017:!1,es2018:!1,string:""},{code:8192,description:"En quad",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8193,description:"Em quad",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8194,description:"En space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8195,description:"Em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8196,description:"Three-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8197,description:"Four-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8198,description:"Six-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8199,description:"Figure space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8200,description:"Punctuation space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8201,description:"Thin space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8202,description:"Hair space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8232,description:"Line separator",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2028"},{code:8233,description:"Paragraph separator",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2029"},{code:8239,description:"Narrow no-break space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8287,description:"Medium mathematical space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:12288,description:"Ideographic space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:65279,description:"Byte Order Mark",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\ufeff"}],Z="",tt=Y.length,et=0;et<tt;et+=1)Y[et].es2016&&Y[et].string,Y[et].es2018&&(Z+=Y[et].string);var nt=Z,rt=new(0,/none/.constructor)("^[".concat(nt,"]+")),ot=R("".replace),it=function(t){return ot(W(t),rt,"")},ut=new(0,/none/.constructor)("[".concat(nt,"]+$")),ct=R("".replace),st=function(t){return ct(W(t),ut,"")},ft=function(t){return it(st(t))},at=new(0,/none/.constructor)("[".concat(nt,"]+"),"g"),lt=R(" ".replace),pt=function(t){return lt(ft(t),at," ")},yt=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,bt=R("".replace),dt=function(t,e){return bt(W(t),yt,arguments.length>1?Q(e):"")},vt=G.constructor,gt=R(G.toString),mt=/^class /,ht=R(mt.test),wt=!1===G(function(){return vt('"use strict"; return class My {};')()}).threw,St=function(t){return ht(mt,pt(dt(gt(t)," ")))},_t=function(t){var e=G(St,t);return!1===e.threw&&e.value},jt=function(t,e){return!o(t)&&(U?function(t,e){return!(wt&&!1===e&&_t(t)||!1!==G(function(){return gt(t)}).threw)}(t,D(e)):(!wt||!1!==D(e)||!_t(t))&&function(t){var e=q(t);return"[object Function]"===e||"[object GeneratorFunction]"===e||"[object AsyncFunction]"===e}(t))},Ot=function(t){return!1===o(t)&&!1===jt(t,!0)},xt={}.constructor,Tt=function(t){return xt(J(t))},Et=n(2),$t=n.n(Et),Pt="string".constructor,Ft=(0).constructor,Mt=H&&Symbol.toPrimitive,kt=H&&Symbol.prototype.valueOf,Nt=["toString","valueOf"],It=["valueOf","toString"],Ct=function(t,e){J(t),function(t){if("string"!=typeof t||"number"!==t&&"string"!==t)throw new TypeError('hint must be "string" or "number"')}(e);for(var n="string"===e?Nt:It,r=0;r<2;r+=1){var i=t[n[r]];if(jt(i)){var u=C(i,t);if(o(u))return u}}throw new TypeError("No default value")},Gt=function(t,e){if(e){if(t===Pt)return"string";if(t===Ft)return"number"}return"default"},Dt=function(t){if(H){if(Mt)return function(t,e){var n=t[e];if(!1===V(n)){if(!1===jt(n))throw new TypeError("".concat(n," returned for property ").concat(e," of object ").concat(t," is not a function"));return n}}(t,Mt);if(z()(t))return kt}},At=function(t){var e=t.exoticToPrim,n=t.input,r=t.hint,i=C(e,n,[r]);if(o(i))return i;throw new TypeError("unable to convert exotic object to primitive")},Rt=function(t,e){var n="default"===e&&($t()(t)||z()(t))?"string":e;return Ct(t,"default"===n?"number":n)},Xt=function(t,e){if(o(t))return t;var n=Gt(e,arguments.length>1),r=Dt(t);return void 0===r?Rt(t,n):At({exoticToPrim:r,input:t,hint:n})};function qt(t){return(qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Lt,zt,Bt,Ht=function(t){var e=Xt(t,String);return H&&"symbol"===qt(e)?e:Q(e)},Ut=R({}.hasOwnProperty),Vt=function(t,e){return Ut(Tt(t),Ht(e))},Jt=H&&Symbol.prototype.toString,Kt="function"==typeof Jt&&z.a,Qt="".constructor,Wt=function(t){return Kt&&Kt(t)?Jt.call(t):Qt(t)},Yt=parseInt,Zt=(0).constructor,te=R("".charAt),ee=/^[-+]?0[xX]/,ne=R(ee.test),re=function(t,e){var n=it(Q(t));return""===te(n,0)?NaN:Yt(n,Zt(e)||(ne(ee,n)?16:10))},oe=2..constructor,ie=R("Cannot convert a Symbol value to a number".slice),ue=/^0b[01]+$/i,ce=ue.constructor,se=R(ue.test),fe=/^0o[0-7]+$/i,ae=new ce("[
]","g"),le=/^[-+]0x[0-9a-f]+$/i,pe=function(t,e){return re(ie(t,2),e)},ye=function(t,e){return function(t){return se(ue,t)}(e)?t(pe(e,2)):function(t){return se(fe,t)}(e)?t(pe(e,8)):null},be=function(t,e){var n=ye(t,e);if(null!==n)return n;if(function(t){return se(ae,t)}(e)||function(t){return se(le,t)}(e))return NaN;var r=ft(e);return r!==e?t(r):null},de=function t(e){var n=function(t){if(z()(t))throw new TypeError("Cannot convert a Symbol value to a number");return t}(Xt(e,oe));if("string"==typeof n){var r=be(t,n);if(null!==r)return r}return oe(n)},ve=function(t){return t!=t},ge=function(t){return"number"==typeof t&&!1===ve(t)&&t!==1/0&&t!==-1/0},me=function(t){var e=de(t);return 0===e||ve(e)?e:e>0?1:-1},he=Math.abs,we=Math.floor,Se=function(t){var e=de(t);return ve(e)?0:0===e||!1===ge(e)?e:me(e)*we(he(e))},_e=function(t){var e=de(t[1]),n=t.length<3?{max:e,min:0}:{max:de(t[2]),min:e};if(n.min>n.max)throw new RangeError('"min" must be less than "max"');return n},je=function(t){var e=de(t);if(arguments.length<2)return e;var n=_e(arguments),r=n.max,o=n.min;return e<o?o:e>r?r:e},Oe=/^(?:0|[1-9]\d*)$/,xe=Oe.test,Te=function(t,e){var n=Wt(t);if(!1===xe.call(Oe,n))return!1;var r=de(n);return arguments.length>1?r<je(Se(e),9007199254740991):r<9007199254740991},Ee=R({}.propertyIsEnumerable),$e=function(t,e){return Ee(Tt(t),Ht(e))},Pe=R("".charAt),Fe={}.constructor,Me=Fe.getOwnPropertyDescriptor,ke="function"==typeof Me&&Me,Ne=function(t,e){t[Ht(e)]=0;var n=G(ke,t,e);return!1===n.threw&&0===n.value.value},Ie=Fe.prototype,Ce=Vt(Ie,"__defineGetter__"),Ge=Ce&&R(Ie.__lookupGetter__),De=Ce&&R(Ie.__lookupSetter__);if(ke){var Ae="undefined"!=typeof document&&document;if(!Ae||Ne(Ae.createElement("div"),"sentinel")){var Re=G(ke,Tt("abc"),1);if(!1===Re.threw&&Re.value&&"b"===Re.value.value)if(Ne({},"sentinel")){var Xe=!1===G(ke,42,"name").threw;Bt=H&&Ne({},Tt(Symbol("")))?Xe?ke:function(t,e){return ke(Tt(t),e)}:Xe?function(t,e){return ke(t,Ht(e))}:function(t,e){return ke(Tt(t),Ht(e))}}else Lt=ke;else zt=ke}}(!1===D(Bt)||Lt||zt)&&(Bt=function(t,e){var n,r=Tt(t),i=Ht(e);if(Lt&&!1===(n=G(function(){return Lt(Tt(r),i)})).threw)return n.value;var c=u()(r)&&Te(i,r.length);if(zt&&!1===c&&!1===(n=G(function(){return zt(Tt(r),i)})).threw)return n.value;var s=void 0;if(!1===c&&!1===Vt(r,i))return s;if(s={configurable:!1===o(t)&&!1===c,enumerable:$e(r,i)},Ce){var f=r.__proto__,a=r!==Ie;a&&(r.__proto__=Ie);var l=Ge(r,i),p=De(r,i);if(a&&(r.__proto__=f),l||p)return l&&(s.get=l),p&&(s.set=p),s}return c?(s.value=Pe(r,i),s.writable=!1):(s.value=r[i],s.writable=!0),s});var qe,Le,ze=Bt,Be=function(t,e){if(o(t)){var n=arguments.length>1?Wt(e):"".concat(Wt(t)," is not an object");throw new TypeError(n)}return t},He={}.constructor,Ue=He.defineProperty,Ve="function"==typeof Ue&&Ue,Je=function(t){var e=Tt(t),n={};if(Vt(e,"enumerable")&&(n.enumerable=D(e.enumerable)),Vt(e,"configurable")&&(n.configurable=D(e.configurable)),Vt(e,"value")&&(n.value=e.value),Vt(e,"writable")&&(n.writable=D(e.writable)),Vt(e,"get")){var r=e.get;if(void 0!==r&&!1===jt(r))throw new TypeError("getter must be a function");n.get=r}if(Vt(e,"set")){var o=e.set;if(void 0!==o&&!1===jt(o))throw new TypeError("setter must be a function");n.set=o}if((Vt(n,"get")||Vt(n,"set"))&&(Vt(n,"value")||Vt(n,"writable")))throw new TypeError("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return n},Ke=He.prototype,Qe=Vt(Ke,"__defineGetter__"),We=Qe&&R(Ke.__defineGetter__),Ye=Qe&&R(Ke.__defineSetter__),Ze=Qe&&R(Ke.__lookupGetter__),tn=Qe&&R(Ke.__lookupSetter__);if(Ve){var en=function(t){var e=G(Ve,t,"sentinel",{});return!1===e.threw&&e.value===t&&"sentinel"in t},nn="undefined"!=typeof document&&document;en({})&&(!1===D(nn)||en(nn.createElement("div")))?Le=function(t,e,n){return Ve(Be(t),Ht(e),Je(n))}:qe=Ve}(!1===D(Ve)||qe)&&(Le=function(t,e,n){Be(t);var r=Ht(e),o=Je(n);if(qe){var i=G(function(){return qe(He,t,r,o)});if(!1===i.threw)return i.value}if(Vt(o,"value"))if(Qe&&(Ze(t,r)||tn(t,r))){var u=t.__proto__;t.__proto__=Ke,delete t[r],t[r]=o.value,t.__proto__=u}else t[r]=o.value;else{if(!1===Qe&&(o.get||o.set))throw new TypeError("getters & setters can not be defined on this javascript engine");o.get&&We(t,r,o.get),o.set&&Ye(t,r,o.set)}return t});var rn=Le,on=R(/none/.exec);e.default=function(t){if(!1===Ot(t))return!1;if(!1===U)return"[object RegExp]"===q(t);var e=ze(t,"lastIndex");return!0===(e&&Vt(e,"value"))&&function(t,e){try{return t.lastIndex=0,on(t),!0}catch(t){return!1}finally{rn(t,"lastIndex",e)}}(t,e)}}])});
//# sourceMappingURL=is-regexp-x.min.js.map