UNPKG

u

Version:

A minimalist, functional utility library designed for embedding into another small program.

1 lines 1.26 kB
u=function(a,b,c,d,e,f){function p(b,c,e,f,g,h){h=h||a,e="expires="+(e||"Sun, 24-Mar-2024 11:11:11 GMT"),f="path="+(f||"/"),g="domain="+(g||h.domain),h.cookie=[b+"="+d(c),e,g,f].join("; ");return m(a.cookie,"; ")}function o(a,b){var c=h.call(arguments,0),a=c.shift(),b=c.shift();return function(){return a.apply(b,c.concat(h.call(arguments,0)))}}function n(a,b){return j(h.call(arguments,1),function(a,b){return j(b,function(a,b,c){a[c]=b;return a},a)},a)}function m(a,b){return j(a.split(b||"&"),function(a,b){var c=b.split("="),d=c[0],f=c[1];d&&(a[e(d)]=e(f));return a},{})}function l(a,b){return j(a,function(a,b,c){a.push(d(c)+"="+d(b));return a},[]).join(b||"&")}function k(a,d,e){if(!a)return a;var f;a instanceof b?f=new b(a.length):f=new(a.constructor||c);return j(a,function(a,b,c,e){a[c]=d.call(this,b,c,e);return a},f,e)}function j(a,c,d,e){if(!a)return d;if(a instanceof b)for(var f=0,g=a.length,h=a[0];f<g;h=a[++f])d=c.call(e||a,d,h,f,a);else for(var i in a)d=c.call(e||a,d,a[i],i,a);return d}function i(a){return a.replace(/(^\s+|\s+$)/g,"")}var g=typeof exports!="undefined"?exports:this,h=[].slice,q={strip:i,reduce:j,map:k,toKV:l,fromKV:m,extend:n,bind:o,setCookie:p};n(g,q);return q}(document,Array,Object,encodeURIComponent,decodeURIComponent)