mime-matcher
Version:
Utility function checking if string is mime type from allowed range
1 lines • 14.5 kB
JavaScript
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("mime-matcher",[],n):"object"==typeof exports?exports["mime-matcher"]=n():t["mime-matcher"]=n()}("undefined"!=typeof self?self:this,function(){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r={};return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=32)}([function(t,n,r){var e=r(24)("wks"),o=r(25),i=r(2).Symbol,u="function"==typeof i;(t.exports=function(t){return e[t]||(e[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=e},function(t,n){var r=t.exports={version:"2.6.10"};"number"==typeof __e&&(__e=r)},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n){t.exports={}},function(t,n,r){var e=r(5),o=r(11);t.exports=r(7)?function(t,n,r){return e.f(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(6),o=r(39),i=r(40),u=Object.defineProperty;n.f=r(7)?Object.defineProperty:function(t,n,r){if(e(t),n=i(n,!0),e(r),o)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){var e=r(10);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n,r){t.exports=!r(18)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n,r){var e=r(2),o=r(1),i=r(17),u=r(4),c=r(8),f=function(t,n,r){var a,s,l,p=t&f.F,v=t&f.G,y=t&f.S,d=t&f.P,h=t&f.B,x=t&f.W,m=v?o:o[n]||(o[n]={}),b=m.prototype,_=v?e:y?e[n]:(e[n]||{}).prototype;v&&(r=n);for(a in r)(s=!p&&_&&void 0!==_[a])&&c(m,a)||(l=s?_[a]:r[a],m[a]=v&&"function"!=typeof _[a]?r[a]:h&&s?i(l,e):x&&_[a]==l?function(t){var n=function(n,r,e){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,r)}return new t(n,r,e)}return t.apply(this,arguments)};return n.prototype=t.prototype,n}(l):d&&"function"==typeof l?i(Function.call,l):l,d&&((m.virtual||(m.virtual={}))[a]=l,t&f.R&&b&&!b[a]&&u(b,a,l)))};f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,r){"use strict";var e=r(43)(!0);r(20)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,r=this._i;return r>=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})})},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,r){var e=r(50),o=r(14);t.exports=function(t){return e(o(t))}},function(t,n,r){var e=r(24)("keys"),o=r(25);t.exports=function(t){return e[t]||(e[t]=o(t))}},function(t,n,r){var e=r(38);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,r){var e=r(10),o=r(2).document,i=e(o)&&e(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,r){"use strict";var e=r(21),o=r(9),i=r(44),u=r(4),c=r(3),f=r(45),a=r(27),s=r(54),l=r(0)("iterator"),p=!([].keys&&"next"in[].keys()),v=function(){return this};t.exports=function(t,n,r,y,d,h,x){f(r,n,y);var m,b,_,g=function(t){if(!p&&t in M)return M[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},w=n+" Iterator",O="values"==d,S=!1,M=t.prototype,j=M[l]||M["@@iterator"]||d&&M[d],T=j||g(d),L=d?O?g("entries"):T:void 0,A="Array"==n?M.entries||j:j;if(A&&(_=s(A.call(new t)))!==Object.prototype&&_.next&&(a(_,w,!0),e||"function"==typeof _[l]||u(_,l,v)),O&&j&&"values"!==j.name&&(S=!0,T=function(){return j.call(this)}),e&&!x||!p&&!S&&M[l]||u(M,l,T),c[n]=T,c[w]=v,d)if(m={values:O?T:g("values"),keys:h?T:g("keys"),entries:L},x)for(b in m)b in M||i(M,b,m[b]);else o(o.P+o.F*(p||S),n,m);return m}},function(t,n){t.exports=!0},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n,r){var e=r(13),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,n,r){var e=r(1),o=r(2),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:e.version,mode:r(21)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,r){var e=r(5).f,o=r(8),i=r(0)("toStringTag");t.exports=function(t,n,r){t&&!o(t=r?t:t.prototype,i)&&e(t,i,{configurable:!0,value:n})}},function(t,n,r){var e=r(14);t.exports=function(t){return Object(e(t))}},function(t,n,r){var e=r(30),o=r(0)("iterator"),i=r(3);t.exports=r(1).getIteratorMethod=function(t){if(void 0!=t)return t[o]||t["@@iterator"]||i[e(t)]}},function(t,n,r){var e=r(22),o=r(0)("toStringTag"),i="Arguments"==e(function(){return arguments}()),u=function(t,n){try{return t[n]}catch(t){}};t.exports=function(t){var n,r,c;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=u(n=Object(t),o))?r:i?e(n):"Object"==(c=e(n))&&"function"==typeof n.callee?"Arguments":c}},function(t,n,r){r(63);for(var e=r(2),o=r(4),i=r(3),u=r(0)("toStringTag"),c="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),f=0;f<c.length;f++){var a=c[f],s=e[a],l=s&&s.prototype;l&&!l[u]&&o(l,u,a),i[a]=i.Array}},function(t,n,r){"use strict";function e(t){return"*"===t?function(){return!0}:function(n){return n===t}}function o(t){if(!t)return{valid:!1};var n=t.match(y),r=Boolean(n);if(!r)return{valid:!1};var e=l()(n),o=v()(e,4);return{valid:r,type:o[1],subType:o[2],parameter:o[3]}}function i(t){return o(t).valid}Object.defineProperty(n,"__esModule",{value:!0}),r.d(n,"isValid",function(){return i}),r.d(n,"parse",function(){return o});var u=r(33),c=r.n(u),f=r(34),a=r.n(f),s=r(41),l=r.n(s),p=r(60),v=r.n(p),y=/^(\*|[a-z0-9._\-]+)\/(\*|[a-z0-9._\-]+)(?:; ([a-zA-Z0-9._\-=]+))?$/,d=function(){function t(){var n=this;c()(this,t),this.expected=[];for(var r=arguments.length,i=Array(r),u=0;u<r;u++)i[u]=arguments[u];i.forEach(function(t){var r=o(t),i=r.valid,u=r.type,c=r.subType;if(!i){var f='Value "'+t+'" is not valid mime type.It should have format "type/subtype".';throw new TypeError(f)}n.expected.push({typeMatcher:e(u),subTypeMatcher:e(c)})})}return a()(t,[{key:"match",value:function(t){var n=o(t),r=n.valid,e=n.type,i=n.subType;return!!r&&this.expected.some(function(t){var n=t.typeMatcher,r=t.subTypeMatcher;return n(e)&&r(i)})}}]),t}();n.default=d},function(t,n,r){"use strict";n.__esModule=!0,n.default=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}},function(t,n,r){"use strict";n.__esModule=!0;var e=r(35),o=function(t){return t&&t.__esModule?t:{default:t}}(e);n.default=function(){function t(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),(0,o.default)(t,e.key,e)}}return function(n,r,e){return r&&t(n.prototype,r),e&&t(n,e),n}}()},function(t,n,r){t.exports={default:r(36),__esModule:!0}},function(t,n,r){r(37);var e=r(1).Object;t.exports=function(t,n,r){return e.defineProperty(t,n,r)}},function(t,n,r){var e=r(9);e(e.S+e.F*!r(7),"Object",{defineProperty:r(5).f})},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,r){t.exports=!r(7)&&!r(18)(function(){return 7!=Object.defineProperty(r(19)("div"),"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(10);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n,r){t.exports={default:r(42),__esModule:!0}},function(t,n,r){r(12),r(55),t.exports=r(1).Array.from},function(t,n,r){var e=r(13),o=r(14);t.exports=function(t){return function(n,r){var i,u,c=String(o(n)),f=e(r),a=c.length;return f<0||f>=a?t?"":void 0:(i=c.charCodeAt(f),i<55296||i>56319||f+1===a||(u=c.charCodeAt(f+1))<56320||u>57343?t?c.charAt(f):i:t?c.slice(f,f+2):u-56320+(i-55296<<10)+65536)}}},function(t,n,r){t.exports=r(4)},function(t,n,r){"use strict";var e=r(46),o=r(11),i=r(27),u={};r(4)(u,r(0)("iterator"),function(){return this}),t.exports=function(t,n,r){t.prototype=e(u,{next:o(1,r)}),i(t,n+" Iterator")}},function(t,n,r){var e=r(6),o=r(47),i=r(26),u=r(16)("IE_PROTO"),c=function(){},f=function(){var t,n=r(19)("iframe"),e=i.length;for(n.style.display="none",r(53).appendChild(n),n.src="javascript:",t=n.contentWindow.document,t.open(),t.write("<script>document.F=Object<\/script>"),t.close(),f=t.F;e--;)delete f.prototype[i[e]];return f()};t.exports=Object.create||function(t,n){var r;return null!==t?(c.prototype=e(t),r=new c,c.prototype=null,r[u]=t):r=f(),void 0===n?r:o(r,n)}},function(t,n,r){var e=r(5),o=r(6),i=r(48);t.exports=r(7)?Object.defineProperties:function(t,n){o(t);for(var r,u=i(n),c=u.length,f=0;c>f;)e.f(t,r=u[f++],n[r]);return t}},function(t,n,r){var e=r(49),o=r(26);t.exports=Object.keys||function(t){return e(t,o)}},function(t,n,r){var e=r(8),o=r(15),i=r(51)(!1),u=r(16)("IE_PROTO");t.exports=function(t,n){var r,c=o(t),f=0,a=[];for(r in c)r!=u&&e(c,r)&&a.push(r);for(;n.length>f;)e(c,r=n[f++])&&(~i(a,r)||a.push(r));return a}},function(t,n,r){var e=r(22);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n,r){var e=r(15),o=r(23),i=r(52);t.exports=function(t){return function(n,r,u){var c,f=e(n),a=o(f.length),s=i(u,a);if(t&&r!=r){for(;a>s;)if((c=f[s++])!=c)return!0}else for(;a>s;s++)if((t||s in f)&&f[s]===r)return t||s||0;return!t&&-1}}},function(t,n,r){var e=r(13),o=Math.max,i=Math.min;t.exports=function(t,n){return t=e(t),t<0?o(t+n,0):i(t,n)}},function(t,n,r){var e=r(2).document;t.exports=e&&e.documentElement},function(t,n,r){var e=r(8),o=r(28),i=r(16)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),e(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n,r){"use strict";var e=r(17),o=r(9),i=r(28),u=r(56),c=r(57),f=r(23),a=r(58),s=r(29);o(o.S+o.F*!r(59)(function(t){Array.from(t)}),"Array",{from:function(t){var n,r,o,l,p=i(t),v="function"==typeof this?this:Array,y=arguments.length,d=y>1?arguments[1]:void 0,h=void 0!==d,x=0,m=s(p);if(h&&(d=e(d,y>2?arguments[2]:void 0,2)),void 0==m||v==Array&&c(m))for(n=f(p.length),r=new v(n);n>x;x++)a(r,x,h?d(p[x],x):p[x]);else for(l=m.call(p),r=new v;!(o=l.next()).done;x++)a(r,x,h?u(l,d,[o.value,x],!0):o.value);return r.length=x,r}})},function(t,n,r){var e=r(6);t.exports=function(t,n,r,o){try{return o?n(e(r)[0],r[1]):n(r)}catch(n){var i=t.return;throw void 0!==i&&e(i.call(t)),n}}},function(t,n,r){var e=r(3),o=r(0)("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(e.Array===t||i[o]===t)}},function(t,n,r){"use strict";var e=r(5),o=r(11);t.exports=function(t,n,r){n in t?e.f(t,n,o(0,r)):t[n]=r}},function(t,n,r){var e=r(0)("iterator"),o=!1;try{var i=[7][e]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}t.exports=function(t,n){if(!n&&!o)return!1;var r=!1;try{var i=[7],u=i[e]();u.next=function(){return{done:r=!0}},i[e]=function(){return u},t(i)}catch(t){}return r}},function(t,n,r){"use strict";function e(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0;var o=r(61),i=e(o),u=r(67),c=e(u);n.default=function(){function t(t,n){var r=[],e=!0,o=!1,i=void 0;try{for(var u,f=(0,c.default)(t);!(e=(u=f.next()).done)&&(r.push(u.value),!n||r.length!==n);e=!0);}catch(t){o=!0,i=t}finally{try{!e&&f.return&&f.return()}finally{if(o)throw i}}return r}return function(n,r){if(Array.isArray(n))return n;if((0,i.default)(Object(n)))return t(n,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(t,n,r){t.exports={default:r(62),__esModule:!0}},function(t,n,r){r(31),r(12),t.exports=r(66)},function(t,n,r){"use strict";var e=r(64),o=r(65),i=r(3),u=r(15);t.exports=r(20)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,o(1)):"keys"==n?o(0,r):"values"==n?o(0,t[r]):o(0,[r,t[r]])},"values"),i.Arguments=i.Array,e("keys"),e("values"),e("entries")},function(t,n){t.exports=function(){}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,r){var e=r(30),o=r(0)("iterator"),i=r(3);t.exports=r(1).isIterable=function(t){var n=Object(t);return void 0!==n[o]||"@@iterator"in n||i.hasOwnProperty(e(n))}},function(t,n,r){t.exports={default:r(68),__esModule:!0}},function(t,n,r){r(31),r(12),t.exports=r(69)},function(t,n,r){var e=r(6),o=r(29);t.exports=r(1).getIterator=function(t){var n=o(t);if("function"!=typeof n)throw TypeError(t+" is not iterable!");return e(n.call(t))}}])});