Module 589841

2,798 characters · in no known chunk
Dependencies
Required by (2)
Lazily required by (0)none
Requires (1)
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";var i=n(404312),r=Object.prototype.hasOwnProperty,s=Array.isArray,a=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),o=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(s(n)){for(var i=[],r=0;r<n.length;++r)void 0!==n[r]&&i.push(n[r]);t.obj[t.prop]=i}}},l=function(e,t){for(var n=t&&t.plainObjects?{__proto__:null}:{},i=0;i<e.length;++i)void 0!==e[i]&&(n[i]=e[i]);return n};e.exports={arrayToObject:l,assign:function(e,t){return Object.keys(t).reduce(function(e,n){return e[n]=t[n],e},e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],i=0;i<t.length;++i)for(var r=t[i],s=r.obj[r.prop],a=Object.keys(s),l=0;l<a.length;++l){var u=a[l],c=s[u];"object"==typeof c&&null!==c&&-1===n.indexOf(c)&&(t.push({obj:s,prop:u}),n.push(c))}return o(t),e},decode:function(e,t,n){var i=e.replace(/\+/g," ");if("iso-8859-1"===n)return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch(e){return i}},encode:function(e,t,n,r,s){if(0===e.length)return e;var o=e;if("symbol"==typeof e?o=Symbol.prototype.toString.call(e):"string"!=typeof e&&(o=String(e)),"iso-8859-1"===n)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var l="",u=0;u<o.length;u+=1024){for(var c=o.length>=1024?o.slice(u,u+1024):o,d=[],_=0;_<c.length;++_){var f=c.charCodeAt(_);if(45===f||46===f||95===f||126===f||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||s===i.RFC1738&&(40===f||41===f)){d[d.length]=c.charAt(_);continue}if(f<128){d[d.length]=a[f];continue}if(f<2048){d[d.length]=a[192|f>>6]+a[128|63&f];continue}if(f<55296||f>=57344){d[d.length]=a[224|f>>12]+a[128|f>>6&63]+a[128|63&f];continue}_+=1,f=65536+((1023&f)<<10|1023&c.charCodeAt(_)),d[d.length]=a[240|f>>18]+a[128|f>>12&63]+a[128|f>>6&63]+a[128|63&f]}l+=d.join("")}return l},isBuffer:function(e){return!!e&&"object"==typeof e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(s(e)){for(var n=[],i=0;i<e.length;i+=1)n.push(t(e[i]));return n}return t(e)},merge:function e(t,n,i){if(!n)return t;if("object"!=typeof n&&"function"!=typeof n){if(s(t))t.push(n);else{if(!t||"object"!=typeof t)return[t,n];(i&&(i.plainObjects||i.allowPrototypes)||!r.call(Object.prototype,n))&&(t[n]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(n);var a=t;return(s(t)&&!s(n)&&(a=l(t,i)),s(t)&&s(n))?(n.forEach(function(n,s){if(r.call(t,s)){var a=t[s];a&&"object"==typeof a&&n&&"object"==typeof n?t[s]=e(a,n,i):t.push(n)}else t[s]=n}),t):Object.keys(n).reduce(function(t,s){var a=n[s];return r.call(t,s)?t[s]=e(t[s],a,i):t[s]=a,t},a)}}}