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