UNPKG

u

Version:

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

1 lines 3.11 kB
(function(a,b,c){var d="prototype",e=c[d],f=b[d],g=f.slice,h=a[d],i=h.hasOwnProperty,j=h.__lookupGetter__,k=h.__lookupSetter__,l=h.__defineGetter__,m=h.__defineSetter__,n=h.toString;b.slice||(b.slice=function(a){return g.apply(a,g.call(arguments,1))}),f.indexOf||(f.indexOf=function(a){for(var b=this,c=0,d=b.length;c<d;++c)if(b[c]===a)return c;return-1}),f.lastIndexOf||(f.lastIndexOf=function(a){for(var b=this,c=b.length-1;c>=0;--c)if(b[c]===a)return c;return-1}),f.map||(f.forEach=function(a,b){for(var c=this,b=b||c,d=0,e=c.length;d<e;++d)a.call(b,c[d],d,c)},f.map=function(a,c){for(var d=this,c=c||d,e=0,f=d.length,g=new b(f);e<f;++e)g[e]=a.call(c,d[e],e,d);return g},f.filter=function(a,b){for(var c=this,b=b||c,d=0,e=c.length,f=[],g=c[0];d<e;g=c[++d])a.call(b,g,d,c)&&f.push(g);return f},f.every=function(a,b){var c=this,b=b||c;for(var d=0,e=c.length;d<e;++d)if(d in c&&!a.call(b,c[d],d,c))return!1;return!0},f.some=function(a,b){var c=this,b=b||c;for(var d=0,e=c.length;d<e;++d)if(d in c&&a.call(b,c[d],d,c))return!0;return!1}),f.reduce||(f.reduce=function(a,b,c){for(var d=this,c=c||d,e=0,f=d.length;e<f;++e)b=a.call(c,b,d[e],e,d);return b}),b.isArray||(b.isArray=function(a){return n.call(a)==="[object Array]"}),e.bind||(e.bind=function(a){var b=this,c=g.call(arguments,1);return function(){return b.apply(a,c.concat(g.call(arguments,0)))}}),a.getPrototypeOf||(a.getPrototypeOf=typeof "".__proto__=="object"?function(a){return a.__proto__}:function(a){return a.constructor[d]}),a.keys||(a.keys=function D(a){var b,D=[];for(b in a)i.call(a,b)&&D.push(b);return D});if(!a.defineProperty){function o(a){return typeof a=="function"}function p(a){if(typeof a!="object"||a===null)throw new TypeError("Property description must be an object: "+a);var b={},c=a.get,d=a.set,e=i.call(a,"value");if(i.call(a,"get")&&c!==undefined){if(!o(c))throw new TypeError("Getter must be a function: "+c);b.get=c}if(i.call(a,"set")&&d!==undefined){if(!o(d))throw new TypeError("Setter must be a function: "+d);b.set=d}if(e&&(b.get||b.set))throw new TypeError("Invalid property. A property cannot both have accessors and be writable or have a value: "+a);e&&(b.value=a.value);return b}a.defineProperty=function(a,b,c){var d=typeof a;if(a===null||d!=="object"&&d!=="function")throw new TypeError("Object.defineProperty called on non-object: "+a);c=p(c),"value"in c?(delete a[b],a[b]=c.value):(c.get&&l.call(a,b,c.get),c.set&&m.call(a,b,c.set));return a},a.defineProperties=function(b,c){var d=typeof b;if(b===null||d!=="object"&&d!=="function")throw new TypeError("Object.defineProperty called on non-object: "+b);c=Object(c);var e,f={};for(e in c)i.call(c,e)&&(f[e]=p(c[e]));for(e in f)a.defineProperty(b,e,f[e]);return b},a.getOwnPropertyDescriptor=function(a,b){var c=typeof a;if(a===null||c!=="object"&&c!=="function")throw new TypeError("Object.getOwnPropertyDescriptor called on non-object: "+a);if(!i.call(a,b))return undefined;var d=j.call(a,b),e=k.call(a,b),f={configurable:!0,enumerable:!0};d===undefined&&e===undefined?(f.value=a[b],f.writable=!0):(d&&(f.get=d),e&&(f.set=e));return f}}})(Object,Array,Function)