UNPKG

is-map-x

Version:

Detect whether or not an object is an ES6 Map.

15 lines 17.5 kB
/*! { "author": "Graham Fairweather", "copywrite": "Copyright (c) 2015-2017", "date": "2019-08-28T17:55:48.581Z", "describe": "", "description": "Detect whether or not an object is an ES6 Map.", "file": "is-map-x.min.js", "hash": "b083537182a0416ee314", "license": "MIT", "version": "2.1.2" } */ !function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.isMapX=n():t.isMapX=n()}(function(){"use strict";var t,n={}.constructor,e=n.prototype,r=n.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(e,"$$globalThis$$",{get:i,configurable:!0}):e.__defineGetter__("$$globalThis$$",i),t="undefined"==typeof $$globalThis$$?o():$$globalThis$$,delete e.$$globalThis$$,t}catch(t){return o()}}(),function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=6)}([function(t,n,e){"use strict";var r=Object.prototype.toString;if(e(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,n,e){"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,n,e){"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,n,e){"use strict";(function(n){var r=n.Symbol,o=e(5);t.exports=function(){return"function"==typeof r&&("function"==typeof Symbol&&("symbol"==typeof r("foo")&&("symbol"==typeof Symbol("bar")&&o())))}}).call(this,e(4))},function(t,n){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,n,e){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},n=Symbol("test"),e=Object(n);if("string"==typeof n)return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;for(n in t[n]=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]!==n)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,n))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,n);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},function(t,n,e){"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)}e.r(n);var o=function(t){return"object"===r(t)?null===t:"function"!=typeof t},i=e(1),u=e.n(i),c={}.constructor("a"),s="a"===c[0]&&0 in c,f=function(){}.bind,a="function"==typeof f&&function(){var t=null,n=null,e=null,r=[];try{var o=f.apply(function(r,o){return e=this,t=r,n=o,arguments},[r,1]),i=o(2);return 1===o.length&&2===i.length&&1===t&&2===n&&e===r}catch(t){return!1}}()&&function(){var t=null,n=null,e=null,r=[1,2,3],o=function(o,i){return t=o,n=i,e=this,r};try{var i=f.apply(o,[null]),u=new i(1,2);return i.length===o.length&&u===r&&1===t&&2===n&&e!==r}catch(t){return!1}}(),l="".split,p=Math.max,y=o.bind,b=o.call,d=a?y.call(b,l):function(t,n){return l.call(t,n)},g=function(t){return u()(t)?d(t,""):t},v=function(t,n){var e=arguments.length>2?arguments[2]:[];if("string"!=typeof t&&o(t))return e;for(var r=s?t:g(t),i=r.length,u=p(0,n)||0;u<i;u+=1)e[e.length]=t[u];return e};function m(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=[],r=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(r=(u=c.next()).done)&&(e.push(u.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return e}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var h=v.bind,w=v.call,S={},j=S.constructor,O=S.toString,_=function(t,n){return t>=n?t:n},x=function(t){if("function"!=typeof t&&"[object Function]"!==O.apply(t))throw new TypeError("bind called on incompatible "+t)},T=[function(t){return function(){return t.apply(this,v(arguments))}},function(t,n){return function(e){return t.apply(this,v(arguments,n,[e]))}},function(t,n){return function(e,r){return t.apply(this,v(arguments,n,[e,r]))}},function(t,n){return function(e,r,o){return t.apply(this,v(arguments,n,[e,r,o]))}},function(t,n){return function(e,r,o,i){return t.apply(this,v(arguments,n,[e,r,o,i]))}},function(t,n){return function(e,r,o,i,u){return t.apply(this,v(arguments,n,[e,r,o,i,u]))}},function(t,n){return function(e,r,o,i,u,c){return t.apply(this,v(arguments,n,[e,r,o,i,u,c]))}},function(t,n){return function(e,r,o,i,u,c,s){return t.apply(this,v(arguments,n,[e,r,o,i,u,c,s]))}},function(t,n){return function(e,r,o,i,u,c,s,f){return t.apply(this,v(arguments,n,[e,r,o,i,u,c,s,f]))}}],$=function(t){var n=m(t,3),e=n[0],r=n[1],o=n[2],i=_(0,r.length-_(0,o.length-2)),u=T[i],c=u?u(e,i):T[0](e);if(r.prototype){var s=function(){};s.prototype=r.prototype,c.prototype=new s,s.prototype=null}return c},E=function(t,n){var e=t.apply(this,n);return j(e)===e?e:this},P=a?w.bind(h):function(t,n){x(t);var e,r=arguments,o=function(){var o=v(arguments,0,v(r,2));return this instanceof e?E.apply(this,[t,o]):t.apply(n,o)};return e=$([o,t,r])},M=TypeError,F=P.apply,N=P(P.call,F),k=P(F,{}.toString),C=function(t){if("function"!=typeof t&&"[object Function]"!==k(t))throw new M(t+" is not a function");return t},D=function(t,n){return N(C(t),n,v(arguments[2]))},A=function(t){try{return{threw:!1,value:D(t,this,v(arguments,1))}}catch(t){return{threw:!0,value:t}}},I=function(t){return!!t},G={}.toString,X=function(t){return function(t){if("function"!=typeof t&&"[object Function]"!==D(G,t))throw new TypeError("methodize called on incompatible "+t)}(t),function(){return D(t,arguments[0],v(arguments,1))}},q=X({}.toString),z=function(t){return null===t?"[object Null]":void 0===t?"[object Undefined]":q(t)},L=e(0),R=e.n(L);for(var B=A(function(){return function(t,n){if(t!==n)throw new TypeError("Cannot instantiate an arrow function")}(this,void 0),"function"==typeof Symbol&&R()(Symbol(""))}.bind(void 0)),H=!1===B.threw&&!0===B.value,U=H&&R()(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(R()(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,nt=0;nt<tt;nt+=1)Y[nt].es2016&&Y[nt].string,Y[nt].es2018&&(Z+=Y[nt].string);var et=Z,rt=new(0,/none/.constructor)("^[".concat(et,"]+")),ot=X("".replace),it=function(t){return ot(W(t),rt,"")},ut=new(0,/none/.constructor)("[".concat(et,"]+$")),ct=X("".replace),st=function(t){return ct(W(t),ut,"")},ft=function(t){return it(st(t))},at=new(0,/none/.constructor)("[".concat(et,"]+"),"g"),lt=X(" ".replace),pt=function(t){return lt(ft(t),at," ")},yt=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,bt=X("".replace),dt=function(t,n){return bt(W(t),yt,arguments.length>1?Q(n):"")},gt=A.constructor,vt=X(A.toString),mt=/^class /,ht=X(mt.test),wt=!1===A(function(){return gt('"use strict"; return class My {};')()}).threw,St=function(t){return ht(mt,pt(dt(vt(t)," ")))},jt=function(t){var n=A(St,t);return!1===n.threw&&n.value},Ot=function(t,n){return!o(t)&&(U?function(t,n){return!(wt&&!1===n&&jt(t)||!1!==A(function(){return vt(t)}).threw)}(t,I(n)):(!wt||!1!==I(n)||!jt(t))&&function(t){var n=z(t);return"[object Function]"===n||"[object GeneratorFunction]"===n||"[object AsyncFunction]"===n}(t))},_t=function(t){return!1===o(t)&&!1===Ot(t,!0)},xt=function(t){return t!=t},Tt=function(t){return"number"==typeof t&&!1===xt(t)&&t!==1/0&&t!==-1/0},$t=e(2),Et=e.n($t),Pt="string".constructor,Mt=(0).constructor,Ft=H&&Symbol.toPrimitive,Nt=H&&Symbol.prototype.valueOf,kt=["toString","valueOf"],Ct=["valueOf","toString"],Dt=function(t,n){J(t),function(t){if("string"!=typeof t||"number"!==t&&"string"!==t)throw new TypeError('hint must be "string" or "number"')}(n);for(var e="string"===n?kt:Ct,r=0;r<2;r+=1){var i=t[e[r]];if(Ot(i)){var u=D(i,t);if(o(u))return u}}throw new TypeError("No default value")},At=function(t,n){if(n){if(t===Pt)return"string";if(t===Mt)return"number"}return"default"},It=function(t){if(H){if(Ft)return function(t,n){var e=t[n];if(!1===V(e)){if(!1===Ot(e))throw new TypeError("".concat(e," returned for property ").concat(n," of object ").concat(t," is not a function"));return e}}(t,Ft);if(R()(t))return Nt}},Gt=function(t){var n=t.exoticToPrim,e=t.input,r=t.hint,i=D(n,e,[r]);if(o(i))return i;throw new TypeError("unable to convert exotic object to primitive")},Xt=function(t,n){var e="default"===n&&(Et()(t)||R()(t))?"string":n;return Dt(t,"default"===e?"number":e)},qt=function(t,n){if(o(t))return t;var e=At(n,arguments.length>1),r=It(t);return void 0===r?Xt(t,e):Gt({exoticToPrim:r,input:t,hint:e})},zt=parseInt,Lt=(0).constructor,Rt=X("᠎".charAt),Bt=/^[-+]?0[xX]/,Ht=X(Bt.test),Ut=function(t,n){var e=it(Q(t));return"᠎"===Rt(e,0)?NaN:zt(e,Lt(n)||(Ht(Bt,e)?16:10))},Vt=2..constructor,Jt=X("Cannot convert a Symbol value to a number".slice),Kt=/^0b[01]+$/i,Qt=Kt.constructor,Wt=X(Kt.test),Yt=/^0o[0-7]+$/i,Zt=new Qt("[…᠎​￾]","g"),tn=/^[-+]0x[0-9a-f]+$/i,nn=function(t,n){return Ut(Jt(t,2),n)},en=function(t,n){return function(t){return Wt(Kt,t)}(n)?t(nn(n,2)):function(t){return Wt(Yt,t)}(n)?t(nn(n,8)):null},rn=function(t,n){var e=en(t,n);if(null!==e)return e;if(function(t){return Wt(Zt,t)}(n)||function(t){return Wt(tn,t)}(n))return NaN;var r=ft(n);return r!==n?t(r):null},on=function t(n){var e=function(t){if(R()(t))throw new TypeError("Cannot convert a Symbol value to a number");return t}(qt(n,Vt));if("string"==typeof e){var r=rn(t,e);if(null!==r)return r}return Vt(e)},un=function(t){var n=on(t);return 0===n||xt(n)?n:n>0?1:-1},cn=Math.abs,sn=Math.floor,fn=function(t){var n=on(t);return xt(n)?0:0===n||!1===Tt(n)?n:un(n)*sn(cn(n))},an=function(t){return Tt(t)&&fn(t)===t},ln=function(t){return an(t)&&t>=-9007199254740991&&t<=9007199254740991},pn=function(t){return ln(t)&&t>=0},yn={}.constructor,bn=function(t){return yn(J(t))};function dn(t){return(dn="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 gn,vn,mn,hn=function(t){var n=qt(t,String);return H&&"symbol"===dn(n)?n:Q(n)},wn=X({}.hasOwnProperty),Sn=function(t,n){return wn(bn(t),hn(n))},jn=H&&Symbol.prototype.toString,On="function"==typeof jn&&R.a,_n="".constructor,xn=function(t){return On&&On(t)?jn.call(t):_n(t)},Tn=function(t){var n=on(t[1]),e=t.length<3?{max:n,min:0}:{max:on(t[2]),min:n};if(e.min>e.max)throw new RangeError('"min" must be less than "max"');return e},$n=function(t){var n=on(t);if(arguments.length<2)return n;var e=Tn(arguments),r=e.max,o=e.min;return n<o?o:n>r?r:n},En=/^(?:0|[1-9]\d*)$/,Pn=En.test,Mn=function(t,n){var e=xn(t);if(!1===Pn.call(En,e))return!1;var r=on(e);return arguments.length>1?r<$n(fn(n),9007199254740991):r<9007199254740991},Fn=X({}.propertyIsEnumerable),Nn=function(t,n){return Fn(bn(t),hn(n))},kn=X("".charAt),Cn={}.constructor,Dn=Cn.getOwnPropertyDescriptor,An="function"==typeof Dn&&Dn,In=function(t,n){t[hn(n)]=0;var e=A(An,t,n);return!1===e.threw&&0===e.value.value},Gn=Cn.prototype,Xn=Sn(Gn,"__defineGetter__"),qn=Xn&&X(Gn.__lookupGetter__),zn=Xn&&X(Gn.__lookupSetter__);if(An){var Ln="undefined"!=typeof document&&document;if(!Ln||In(Ln.createElement("div"),"sentinel")){var Rn=A(An,bn("abc"),1);if(!1===Rn.threw&&Rn.value&&"b"===Rn.value.value)if(In({},"sentinel")){var Bn=!1===A(An,42,"name").threw;mn=H&&In({},bn(Symbol("")))?Bn?An:function(t,n){return An(bn(t),n)}:Bn?function(t,n){return An(t,hn(n))}:function(t,n){return An(bn(t),hn(n))}}else gn=An;else vn=An}}(!1===I(mn)||gn||vn)&&(mn=function(t,n){var e,r=bn(t),i=hn(n);if(gn&&!1===(e=A(function(){return gn(bn(r),i)})).threw)return e.value;var c=u()(r)&&Mn(i,r.length);if(vn&&!1===c&&!1===(e=A(function(){return vn(bn(r),i)})).threw)return e.value;var s=void 0;if(!1===c&&!1===Sn(r,i))return s;if(s={configurable:!1===o(t)&&!1===c,enumerable:Nn(r,i)},Xn){var f=r.__proto__,a=r!==Gn;a&&(r.__proto__=Gn);var l=qn(r,i),p=zn(r,i);if(a&&(r.__proto__=f),l||p)return l&&(s.get=l),p&&(s.set=p),s}return c?(s.value=kn(r,i),s.writable=!1):(s.value=r[i],s.writable=!0),s});var Hn=mn,Un=function(){return!0},Vn=function(t){return"function"==typeof t?A(t):{threw:!1,value:t}},Jn=function(t,n){var e="function"==typeof arguments[2]?arguments[2]:Un,r=A(function(){return D(t.get,n)});return!1===r.threw&&e(r.value)?t.get:null},Kn=function(t,n){var e=Vn(t);if(!1===e.threw&&_t(e.value)){var r=Hn(e.value.constructor.prototype,n);if(r&&"function"==typeof r.get)return Jn(r,e.value,arguments[2])}return null}(function(){return new Map},"size",pn);n.default=function(t){if(null===Kn||!1===_t(t))return!1;var n=A(function(){return D(Kn,t)});return!1===n.threw&&pn(n.value)}}])}); //# sourceMappingURL=is-map-x.min.js.map