Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Version 2.0.2

  • Loading branch information...
commit 31cdc15b3f5b24118cbd884daefb0db3f7fbb464 1 parent 425c1d8
@kriskowal kriskowal authored
Showing with 19 additions and 17 deletions.
  1. +16 −16 es5-shim.min.js
  2. +2 −0  minify
  3. +1 −1  package.json
View
32 es5-shim.min.js
@@ -1,16 +1,16 @@
-(function(q){"function"==typeof define?define(q):"function"==typeof YUI?YUI.add("es5",q):q()})(function(){function q(b){b=+b;b!==b?b=0:0!==b&&(b!==1/0&&b!==-(1/0))&&(b=(0<b||-1)*Math.floor(Math.abs(b)));return b}function t(b){var c=typeof b;return null===b||"undefined"===c||"boolean"===c||"number"===c||"string"===c}Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if("function"!=typeof c)throw new TypeError("Function.prototype.bind called on incompatible "+c);var d=r.call(arguments,
-1),a=function(){if(this instanceof a){var e=c.apply(this,d.concat(r.call(arguments)));return Object(e)===e?e:this}return c.apply(b,d.concat(r.call(arguments)))};c.prototype&&(a.prototype=Object.create(c.prototype));return a});var k=Function.prototype.call,n=Object.prototype,r=Array.prototype.slice,h=k.bind(n.toString),u=k.bind(n.hasOwnProperty);u(n,"__defineGetter__")&&(k.bind(n.__defineGetter__),k.bind(n.__defineSetter__),k.bind(n.__lookupGetter__),k.bind(n.__lookupSetter__));if(2!=[1,2].splice(0).length){var y=
-Array.prototype.splice;Array.prototype.splice=function(b,c){return!arguments.length?[]:y.apply(this,[b===void 0?0:b,c===void 0?this.length-b:c].concat(r.call(arguments,2)))}}Array.isArray||(Array.isArray=function(b){return h(b)=="[object Array]"});var k=Object("a"),m="a"!=k[0]||!(0 in k);Array.prototype.forEach||(Array.prototype.forEach=function(b,c){var d=l(this),a=m&&h(this)=="[object String]"?this.split(""):d,e=-1,f=a.length>>>0;if(h(b)!="[object Function]")throw new TypeError;for(;++e<f;)e in
-a&&b.call(c,a[e],e,d)});Array.prototype.map||(Array.prototype.map=function(b,c){var d=l(this),a=m&&h(this)=="[object String]"?this.split(""):d,e=a.length>>>0,f=Array(e);if(h(b)!="[object Function]")throw new TypeError(b+" is not a function");for(var g=0;g<e;g++)g in a&&(f[g]=b.call(c,a[g],g,d));return f});Array.prototype.filter||(Array.prototype.filter=function(b,c){var d=l(this),a=m&&h(this)=="[object String]"?this.split(""):d,e=a.length>>>0,f=[],g;if(h(b)!="[object Function]")throw new TypeError(b+
-" is not a function");for(var p=0;p<e;p++)if(p in a){g=a[p];b.call(c,g,p,d)&&f.push(g)}return f});Array.prototype.every||(Array.prototype.every=function(b,c){var d=l(this),a=m&&h(this)=="[object String]"?this.split(""):d,e=a.length>>>0;if(h(b)!="[object Function]")throw new TypeError(b+" is not a function");for(var f=0;f<e;f++)if(f in a&&!b.call(c,a[f],f,d))return false;return true});Array.prototype.some||(Array.prototype.some=function(b,c){var d=l(this),a=m&&h(this)=="[object String]"?this.split(""):
-d,e=a.length>>>0;if(h(b)!="[object Function]")throw new TypeError(b+" is not a function");for(var f=0;f<e;f++)if(f in a&&b.call(c,a[f],f,d))return true;return false});Array.prototype.reduce||(Array.prototype.reduce=function(b){var c=l(this),d=m&&h(this)=="[object String]"?this.split(""):c,a=d.length>>>0;if(h(b)!="[object Function]")throw new TypeError(b+" is not a function");if(!a&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var e=0,f;if(arguments.length>=
-2)f=arguments[1];else{do{if(e in d){f=d[e++];break}if(++e>=a)throw new TypeError("reduce of empty array with no initial value");}while(1)}for(;e<a;e++)e in d&&(f=b.call(void 0,f,d[e],e,c));return f});Array.prototype.reduceRight||(Array.prototype.reduceRight=function(b){var c=l(this),d=m&&h(this)=="[object String]"?this.split(""):c,a=d.length>>>0;if(h(b)!="[object Function]")throw new TypeError(b+" is not a function");if(!a&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");
-var e,a=a-1;if(arguments.length>=2)e=arguments[1];else{do{if(a in d){e=d[a--];break}if(--a<0)throw new TypeError("reduceRight of empty array with no initial value");}while(1)}do a in this&&(e=b.call(void 0,e,d[a],a,c));while(a--);return e});if(!Array.prototype.indexOf||-1!=[0,1].indexOf(1,2))Array.prototype.indexOf=function(b){var c=m&&h(this)=="[object String]"?this.split(""):l(this),d=c.length>>>0;if(!d)return-1;var a=0;arguments.length>1&&(a=q(arguments[1]));for(a=a>=0?a:Math.max(0,d+a);a<d;a++)if(a in
-c&&c[a]===b)return a;return-1};if(!Array.prototype.lastIndexOf||-1!=[0,1].lastIndexOf(0,-3))Array.prototype.lastIndexOf=function(b){var c=m&&h(this)=="[object String]"?this.split(""):l(this),d=c.length>>>0;if(!d)return-1;var a=d-1;arguments.length>1&&(a=Math.min(a,q(arguments[1])));for(a=a>=0?a:d-Math.abs(a);a>=0;a--)if(a in c&&b===c[a])return a;return-1};if(!Object.keys){var w=!0,x="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),z=x.length,
-s;for(s in{toString:null})w=!1;Object.keys=function(b){if(typeof b!="object"&&typeof b!="function"||b===null)throw new TypeError("Object.keys called on a non-object");var c=[],d;for(d in b)u(b,d)&&c.push(d);if(w)for(d=0;d<z;d++){var a=x[d];u(b,a)&&c.push(a)}return c}}if(!Date.prototype.toISOString||-1===(new Date(-621987552E5)).toISOString().indexOf("-000001"))Date.prototype.toISOString=function(){var b,c,d,a;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");
-a=this.getUTCFullYear();b=this.getUTCMonth();a=a+Math.floor(b/12);b=[(b%12+12)%12+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];a=(a<0?"-":a>9999?"+":"")+("00000"+Math.abs(a)).slice(0<=a&&a<=9999?-4:-6);for(c=b.length;c--;){d=b[c];d<10&&(b[c]="0"+d)}return a+"-"+b.slice(0,2).join("-")+"T"+b.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"};s=!1;try{s=Date.prototype.toJSON&&null===(new Date(NaN)).toJSON()&&-1!==(new Date(-621987552E5)).toJSON().indexOf("-000001")&&
-Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(G){}s||(Date.prototype.toJSON=function(){var b=Object(this),c;a:if(t(b))c=b;else{c=b.valueOf;if(typeof c==="function"){c=c.call(b);if(t(c))break a}c=b.toString;if(typeof c==="function"){c=c.call(b);if(t(c))break a}throw new TypeError;}if(typeof c==="number"&&!isFinite(c))return null;c=b.toISOString;if(typeof c!="function")throw new TypeError("toISOString property is not callable");return c.call(b)});var g=Date,v=function(b,c){var d=
-c>1?1:0;return A[c]+Math.floor((b-1969+d)/4)-Math.floor((b-1901+d)/100)+Math.floor((b-1601+d)/400)+365*(b-1970)},o=function c(d,a,e,f,h,p,i){var j=arguments.length;if(this instanceof g){j=j==1&&String(d)===d?new g(c.parse(d)):j>=7?new g(d,a,e,f,h,p,i):j>=6?new g(d,a,e,f,h,p):j>=5?new g(d,a,e,f,h):j>=4?new g(d,a,e,f):j>=3?new g(d,a,e):j>=2?new g(d,a):j>=1?new g(d):new g;j.constructor=c;return j}return g.apply(this,arguments)},B=RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{3}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),
-A=[0,31,59,90,120,151,181,212,243,273,304,334,365],i;for(i in g)o[i]=g[i];o.now=g.now;o.UTC=g.UTC;o.prototype=g.prototype;o.prototype.constructor=o;o.parse=function(c){var d=B.exec(c);if(d){var a=Number(d[1]),e=Number(d[2]||1)-1,f=Number(d[3]||1)-1,h=Number(d[4]||0),i=Number(d[5]||0),k=Number(d[6]||0),j=Number(d[7]||0),m=!d[4]||d[8]?0:Number(new o(1970,0)),l=d[9]==="-"?1:-1,n=Number(d[10]||0),d=Number(d[11]||0);if(h<(i>0||k>0||j>0?24:25)&&i<60&&k<60&&j<1E3&&e>-1&&e<12&&n<24&&d<60&&f>-1&&f<v(a,e+1)-
-v(a,e)){a=((v(a,e)+f)*24+h+n*l)*60;a=((a+i+d*l)*60+k)*1E3+j+m;if(-864E13<=a&&a<=864E13)return a}return NaN}return g.parse.apply(this,arguments)};Date=o;Date.now||(Date.now=function(){return(new Date).getTime()});if("0".split(void 0,0).length){var C=String.prototype.split;String.prototype.split=function(c,d){return c===void 0&&d===0?[]:C.apply(this,arguments)}}if("".substr&&"b"!=="0b".substr(-1)){var D=String.prototype.substr;String.prototype.substr=function(c,d){return D.call(this,c<0?(c=this.length+
-c)<0?0:c:c,d)}}i="\t\n\x0B\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";if(!String.prototype.trim||i.trim()){i="["+i+"]";var E=RegExp("^"+i+i+"*"),F=RegExp(i+i+"*$");String.prototype.trim=function(){if(this===void 0||this===null)throw new TypeError("can't convert "+this+" to object");return String(this).replace(E,"").replace(F,"")}}var l=function(c){if(c==null)throw new TypeError("can't convert "+c+" to object");return Object(c)}});
+(function(p){"function"==typeof define?define(p):"function"==typeof YUI?YUI.add("es5",p):p()})(function(){function p(a){a=+a;a!==a?a=0:0!==a&&(a!==1/0&&a!==-(1/0))&&(a=(0<a||-1)*Math.floor(Math.abs(a)));return a}function s(a){var b=typeof a;return null===a||"undefined"===b||"boolean"===b||"number"===b||"string"===b}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError("Function.prototype.bind called on incompatible "+b);var d=q.call(arguments,
+1),c=function(){if(this instanceof c){var e=b.apply(this,d.concat(q.call(arguments)));return Object(e)===e?e:this}return b.apply(a,d.concat(q.call(arguments)))};b.prototype&&(c.prototype=Object.create(b.prototype));return c});var m=Function.prototype.call,o=Object.prototype,q=Array.prototype.slice,h=m.bind(o.toString),t=m.bind(o.hasOwnProperty);t(o,"__defineGetter__")&&(m.bind(o.__defineGetter__),m.bind(o.__defineSetter__),m.bind(o.__lookupGetter__),m.bind(o.__lookupSetter__));if(2!=[1,2].splice(0).length){var x=
+Array.prototype.splice;Array.prototype.splice=function(a,b){return arguments.length?x.apply(this,[a===void 0?0:a,b===void 0?this.length-a:b].concat(q.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(a){return h(a)=="[object Array]"});var m=Object("a"),k="a"!=m[0]||!(0 in m);Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var d=l(this),c=k&&h(this)=="[object String]"?this.split(""):d,e=-1,f=c.length>>>0;if(h(a)!="[object Function]")throw new TypeError;for(;++e<f;)e in
+c&&a.call(b,c[e],e,d)});Array.prototype.map||(Array.prototype.map=function(a,b){var d=l(this),c=k&&h(this)=="[object String]"?this.split(""):d,e=c.length>>>0,f=Array(e);if(h(a)!="[object Function]")throw new TypeError(a+" is not a function");for(var g=0;g<e;g++)g in c&&(f[g]=a.call(b,c[g],g,d));return f});Array.prototype.filter||(Array.prototype.filter=function(a,b){var d=l(this),c=k&&h(this)=="[object String]"?this.split(""):d,e=c.length>>>0,f=[],g;if(h(a)!="[object Function]")throw new TypeError(a+
+" is not a function");for(var i=0;i<e;i++)if(i in c){g=c[i];a.call(b,g,i,d)&&f.push(g)}return f});Array.prototype.every||(Array.prototype.every=function(a,b){var d=l(this),c=k&&h(this)=="[object String]"?this.split(""):d,e=c.length>>>0;if(h(a)!="[object Function]")throw new TypeError(a+" is not a function");for(var f=0;f<e;f++)if(f in c&&!a.call(b,c[f],f,d))return false;return true});Array.prototype.some||(Array.prototype.some=function(a,b){var d=l(this),c=k&&h(this)=="[object String]"?this.split(""):
+d,e=c.length>>>0;if(h(a)!="[object Function]")throw new TypeError(a+" is not a function");for(var f=0;f<e;f++)if(f in c&&a.call(b,c[f],f,d))return true;return false});Array.prototype.reduce||(Array.prototype.reduce=function(a){var b=l(this),d=k&&h(this)=="[object String]"?this.split(""):b,c=d.length>>>0;if(h(a)!="[object Function]")throw new TypeError(a+" is not a function");if(!c&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var e=0,f;if(arguments.length>=
+2)f=arguments[1];else{do{if(e in d){f=d[e++];break}if(++e>=c)throw new TypeError("reduce of empty array with no initial value");}while(1)}for(;e<c;e++)e in d&&(f=a.call(void 0,f,d[e],e,b));return f});Array.prototype.reduceRight||(Array.prototype.reduceRight=function(a){var b=l(this),d=k&&h(this)=="[object String]"?this.split(""):b,c=d.length>>>0;if(h(a)!="[object Function]")throw new TypeError(a+" is not a function");if(!c&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");
+var e,c=c-1;if(arguments.length>=2)e=arguments[1];else{do{if(c in d){e=d[c--];break}if(--c<0)throw new TypeError("reduceRight of empty array with no initial value");}while(1)}do c in this&&(e=a.call(void 0,e,d[c],c,b));while(c--);return e});if(!Array.prototype.indexOf||-1!=[0,1].indexOf(1,2))Array.prototype.indexOf=function(a){var b=k&&h(this)=="[object String]"?this.split(""):l(this),d=b.length>>>0;if(!d)return-1;var c=0;arguments.length>1&&(c=p(arguments[1]));for(c=c>=0?c:Math.max(0,d+c);c<d;c++)if(c in
+b&&b[c]===a)return c;return-1};if(!Array.prototype.lastIndexOf||-1!=[0,1].lastIndexOf(0,-3))Array.prototype.lastIndexOf=function(a){var b=k&&h(this)=="[object String]"?this.split(""):l(this),d=b.length>>>0;if(!d)return-1;var c=d-1;arguments.length>1&&(c=Math.min(c,p(arguments[1])));for(c=c>=0?c:d-Math.abs(c);c>=0;c--)if(c in b&&a===b[c])return c;return-1};if(!Object.keys){var v=!0,w="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),y=w.length,
+r;for(r in{toString:null})v=!1;Object.keys=function(a){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.keys called on a non-object");var b=[],d;for(d in a)t(a,d)&&b.push(d);if(v)for(d=0;d<y;d++){var c=w[d];t(a,c)&&b.push(c)}return b}}if(!Date.prototype.toISOString||-1===(new Date(-621987552E5)).toISOString().indexOf("-000001"))Date.prototype.toISOString=function(){var a,b,d,c;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");
+c=this.getUTCFullYear();a=this.getUTCMonth();c=c+Math.floor(a/12);a=[(a%12+12)%12+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];c=(c<0?"-":c>9999?"+":"")+("00000"+Math.abs(c)).slice(0<=c&&c<=9999?-4:-6);for(b=a.length;b--;){d=a[b];d<10&&(a[b]="0"+d)}return c+"-"+a.slice(0,2).join("-")+"T"+a.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"};r=!1;try{r=Date.prototype.toJSON&&null===(new Date(NaN)).toJSON()&&-1!==(new Date(-621987552E5)).toJSON().indexOf("-000001")&&
+Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(F){}r||(Date.prototype.toJSON=function(){var a=Object(this),b;a:if(s(a))b=a;else{b=a.valueOf;if(typeof b==="function"){b=b.call(a);if(s(b))break a}b=a.toString;if(typeof b==="function"){b=b.call(a);if(s(b))break a}throw new TypeError;}if(typeof b==="number"&&!isFinite(b))return null;b=a.toISOString;if(typeof b!="function")throw new TypeError("toISOString property is not callable");return b.call(a)});var g=Date,u=function(a,b){var d=
+b>1?1:0;return z[b]+Math.floor((a-1969+d)/4)-Math.floor((a-1901+d)/100)+Math.floor((a-1601+d)/400)+365*(a-1970)},n=function(a,b,d,c,e,f,h){var i=arguments.length;if(this instanceof g){i=i==1&&String(a)===a?new g(n.parse(a)):i>=7?new g(a,b,d,c,e,f,h):i>=6?new g(a,b,d,c,e,f):i>=5?new g(a,b,d,c,e):i>=4?new g(a,b,d,c):i>=3?new g(a,b,d):i>=2?new g(a,b):i>=1?new g(a):new g;i.constructor=n;return i}return g.apply(this,arguments)},A=RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{3}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),
+z=[0,31,59,90,120,151,181,212,243,273,304,334,365],j;for(j in g)n[j]=g[j];n.now=g.now;n.UTC=g.UTC;n.prototype=g.prototype;n.prototype.constructor=Date;n.parse=function(a){var b=A.exec(a);if(b){var d=Number(b[1]),c=Number(b[2]||1)-1,e=Number(b[3]||1)-1,f=Number(b[4]||0),h=Number(b[5]||0),i=Number(b[6]||0),j=Number(b[7]||0),m=!b[4]||b[8]?0:Number(new Date(1970,0)),k=b[9]==="-"?1:-1,l=Number(b[10]||0),b=Number(b[11]||0);if(f<(h>0||i>0||j>0?24:25)&&h<60&&i<60&&j<1E3&&c>-1&&c<12&&l<24&&b<60&&e>-1&&e<u(d,
+c+1)-u(d,c)){d=((u(d,c)+e)*24+f+l*k)*60;d=((d+h+b*k)*60+i)*1E3+j+m;if(-864E13<=d&&d<=864E13)return d}return NaN}return g.parse.apply(this,arguments)};Date=n;Date.now||(Date.now=function(){return(new Date).getTime()});if("0".split(void 0,0).length){var B=String.prototype.split;String.prototype.split=function(a,b){return a===void 0&&b===0?[]:B.apply(this,arguments)}}if("".substr&&"b"!=="0b".substr(-1)){var C=String.prototype.substr;String.prototype.substr=function(a,b){return C.call(this,a<0?(a=this.length+
+a)<0?0:a:a,b)}}j="\t\n\x0B\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";if(!String.prototype.trim||j.trim()){j="["+j+"]";var D=RegExp("^"+j+j+"*"),E=RegExp(j+j+"*$");String.prototype.trim=function(){if(this===void 0||this===null)throw new TypeError("can't convert "+this+" to object");return String(this).replace(D,"").replace(E,"")}}var l=function(a){if(a==null)throw new TypeError("can't convert "+a+" to object");return Object(a)}});
View
2  minify
@@ -0,0 +1,2 @@
+closure < es5-shim.js > es5-shim.min.js
+closure < es5-sham.js > es5-sham.min.js
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "es5-shim",
- "version": "2.0.1",
+ "version": "2.0.2",
"description": "ES5 as implementable on previous engines",
"homepage": "http://github.com/kriskowal/es5-shim/",
"contributors": [
Please sign in to comment.
Something went wrong with that request. Please try again.