Comparing version 1.2.4 to 1.2.6
@@ -183,3 +183,2 @@ // vim:set ts=4 sts=4 sw=4 st: | ||
// | ||
@@ -344,3 +343,2 @@ // Array | ||
// ES5 15.4.4.22 | ||
@@ -827,29 +825,23 @@ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight | ||
// 15.9.1.15 Date Time String Format | ||
// 15.9.1.15 Date Time String Format. This pattern does not implement | ||
// extended years ((15.9.1.15.1), as `Date.UTC` cannot parse them. | ||
var isoDateExpression = new RegExp("^" + | ||
"(?:" + // optional year-month-day | ||
"(" + // year capture | ||
"(?:[+-]\\d\\d)?" + // 15.9.1.15.1 Extended years | ||
"\\d\\d\\d\\d" + // four-digit year | ||
")" + | ||
"(?:-" + // optional month-day | ||
"(\\d\\d)" + // month capture | ||
"(?:-" + // optional day | ||
"(\\d\\d)" + // day capture | ||
")?" + | ||
"(\d{4})" + // four-digit year capture | ||
"(?:-(\d{2})" + // optional month capture | ||
"(?:-(\d{2})" + // optional day capture | ||
"(?:" + // capture hours:minutes:seconds.milliseconds | ||
"T(\d{2})" + // hours capture | ||
":(\d{2})" + // minutes capture | ||
"(?:" + // optional :seconds.milliseconds | ||
":(\d{2})" + // seconds capture | ||
"(?:\.(\d{3}))?" + // milliseconds capture | ||
")?" + | ||
")?" + | ||
"(?:T" + // hour:minute:second.subsecond | ||
"(\\d\\d)" + // hour capture | ||
":(\\d\\d)" + // minute capture | ||
"(?::" + // optional :second.subsecond | ||
"(\\d\\d)" + // second capture | ||
"(?:\\.(\\d\\d\\d))?" + // milisecond capture | ||
")?" + | ||
")?" + | ||
"(?:" + // time zone | ||
"(?:" + // capture UTC offset component | ||
"Z|" + // UTC capture | ||
"([+-])(\\d\\d):(\\d\\d)" + // timezone offset | ||
// capture sign, hour, minute | ||
")?" + | ||
"(?:" + // offset specifier +/-hours:minutes | ||
"([-+])" + // sign capture | ||
"(\d{2})" + // hours offset capture | ||
":(\d{2})" + // minutes offest capture | ||
")" + | ||
")?)?)?)?" + | ||
"$"); | ||
@@ -867,5 +859,3 @@ | ||
// Upgrade Date.parse to handle the ISO dates we use | ||
// TODO review specification to ascertain whether it is | ||
// necessary to implement partial ISO date strings. | ||
// Upgrade Date.parse to handle simplified ISO 8601 strings | ||
Date.parse = function parse(string) { | ||
@@ -875,16 +865,8 @@ var match = isoDateExpression.exec(string); | ||
match.shift(); // kill match[0], the full match | ||
// recognize times without dates before normalizing the | ||
// numeric values, for later use | ||
var timeOnly = match[0] === undefined; | ||
// parse numerics | ||
for (var i = 0; i < 10; i++) { | ||
// skip + or - for the timezone offset | ||
if (i == 7) | ||
continue; | ||
// Note: parseInt would read 0-prefix numbers as | ||
// octal. Number constructor or unary + work better | ||
// here: | ||
// parse months, days, hours, minutes, seconds, and milliseconds | ||
for (var i = 1; i < 7; i++) { | ||
// provide default values if necessary | ||
match[i] = +(match[i] || (i < 3 ? 1 : 0)); | ||
// match[1] is the month. Months are 0-11 in JavaScript | ||
// Date objects, but 1-12 in ISO notation, so we | ||
// `Date` objects, but 1-12 in ISO notation, so we | ||
// decrement. | ||
@@ -894,13 +876,20 @@ if (i == 1) | ||
} | ||
// if no year-month-date is provided, return a milisecond | ||
// quantity instead of a UTC date number value. | ||
if (timeOnly) | ||
return ((match[3] * 60 + match[4]) * 60 + match[5]) * 1000 + match[6]; | ||
// account for an explicit time zone offset if provided | ||
var offset = (match[8] * 60 + match[9]) * 60 * 1000; | ||
if (match[6] == "-") | ||
offset = -offset; | ||
// parse the UTC offset component | ||
var minutesOffset = +match.pop(), hourOffset = +match.pop(), sign = match.pop(); | ||
return NativeDate.UTC.apply(this, match.slice(0, 7)) + offset; | ||
// compute the explicit time zone offset if specified | ||
var offset = 0; | ||
if (sign) { | ||
// detect invalid offsets and return early | ||
if (hourOffset > 23 || minuteOffset > 59) | ||
return NaN; | ||
// express the provided time zone offset in minutes. The offset is | ||
// negative for time zones west of UTC; positive otherwise. | ||
offset = (hourOffset * 60 + minuteOffset) * 6e4 * (sign == "+" ? -1 : 1); | ||
} | ||
// compute a new UTC date value, accounting for the optional offset | ||
return NativeDate.UTC.apply(this, match) + offset; | ||
} | ||
@@ -907,0 +896,0 @@ return NativeDate.parse.apply(this, arguments); |
@@ -1,4 +0,4 @@ | ||
(function(l){typeof define=="function"?define(function(){l()}):l()})(function(l){function m(c){return c<10?"0"+c:c}if(!Function.prototype.bind){var o=Array.prototype.slice;Function.prototype.bind=function(c){var b=this;if(typeof b.apply!="function"||typeof b.call!="function")return new TypeError;var a=o.call(arguments),d=function(){if(this instanceof d){var c=Object.create(b.prototype);return b.apply(c,a.concat(o.call(arguments)))||c}else return b.call.apply(b,a.concat(o.call(arguments)))};try{d.length= | ||
typeof b=="function"?Math.max(b.length-a.length,0):0}catch(e){}return d}}var f=Function.prototype.call,h=Object.prototype,i=f.bind(h.hasOwnProperty),s,t,p,q,n;if(n=i(h,"__defineGetter__"))s=f.bind(h.__defineGetter__),t=f.bind(h.__defineSetter__),p=f.bind(h.__lookupGetter__),q=f.bind(h.__lookupSetter__);if(!Array.isArray)Array.isArray=function(c){return Object.prototype.toString.call(c)=="[object Array]"};if(!Array.prototype.forEach)Array.prototype.forEach=function(c,b){var a=Object(this),d=0,e=a.length>>> | ||
0;if(!c||!c.call)throw new TypeError;for(;d<e;)d in a&&c.call(b,a[d],d,a),d++};if(!Array.prototype.map)Array.prototype.map=function(c,b){var a=Object(this),d=a.length>>>0;if(typeof c!="function")throw new TypeError;for(var e=Array(d),k=0;k<d;k++)k in a&&(e[k]=c.call(b,a[k],k,a));return e};if(!Array.prototype.filter)Array.prototype.filter=function(c,b){for(var a=Object(this),d=a.length>>>0,e=0;e<d;e++)e in a&&c.call(b,a[e],e,a)&&values.push(a[e]);return values};if(!Array.prototype.every)Array.prototype.every= | ||
(function(m){typeof define=="function"?define(function(){m()}):m()})(function(m){function k(c){return c<10?"0"+c:c}if(!Function.prototype.bind){var o=Array.prototype.slice;Function.prototype.bind=function(c){var b=this;if(typeof b.apply!="function"||typeof b.call!="function")return new TypeError;var a=o.call(arguments),d=function(){if(this instanceof d){var c=Object.create(b.prototype);return b.apply(c,a.concat(o.call(arguments)))||c}else return b.call.apply(b,a.concat(o.call(arguments)))};try{d.length= | ||
typeof b=="function"?Math.max(b.length-a.length,0):0}catch(e){}return d}}var f=Function.prototype.call,g=Object.prototype,h=f.bind(g.hasOwnProperty),s,t,p,q,n;if(n=h(g,"__defineGetter__"))s=f.bind(g.__defineGetter__),t=f.bind(g.__defineSetter__),p=f.bind(g.__lookupGetter__),q=f.bind(g.__lookupSetter__);if(!Array.isArray)Array.isArray=function(c){return Object.prototype.toString.call(c)=="[object Array]"};if(!Array.prototype.forEach)Array.prototype.forEach=function(c,b){var a=Object(this),d=0,e=a.length>>> | ||
0;if(!c||!c.call)throw new TypeError;for(;d<e;)d in a&&c.call(b,a[d],d,a),d++};if(!Array.prototype.map)Array.prototype.map=function(c,b){var a=Object(this),d=a.length>>>0;if(typeof c!="function")throw new TypeError;for(var e=Array(d),j=0;j<d;j++)j in a&&(e[j]=c.call(b,a[j],j,a));return e};if(!Array.prototype.filter)Array.prototype.filter=function(c,b){for(var a=Object(this),d=a.length>>>0,e=0;e<d;e++)e in a&&c.call(b,a[e],e,a)&&values.push(a[e]);return values};if(!Array.prototype.every)Array.prototype.every= | ||
function(c,b){if(this===void 0||this===null)throw new TypeError;if(typeof c!=="function")throw new TypeError;for(var a=Object(this),d=a.length>>>0,e=0;e<d;e++)if(e in a&&!c.call(b,a[e],e,a))return!1;return!0};if(!Array.prototype.some)Array.prototype.some=function(c,b){if(this===void 0||this===null)throw new TypeError;if(typeof c!=="function")throw new TypeError;for(var a=Object(this),d=a.length>>>0,e=0;e<d;e++)if(e in a&&c.call(b,a[e],e,a))return!0;return!1};if(!Array.prototype.reduce)Array.prototype.reduce= | ||
@@ -8,10 +8,10 @@ function(c){var b=Object(this),a=b.length>>>0;if(Object.prototype.toString.call(c)!="[object Function]")throw new TypeError;if(!a&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else{do{if(d in b){e=b[d++];break}if(++d>=a)throw new TypeError;}while(1)}for(;d<a;d++)d in b&&(e=c.call(null,e,b[d],d,b));return e};if(!Array.prototype.reduceRight)Array.prototype.reduceRight=function(c){var b=Object(this),a=b.length>>>0;if(Object.prototype.toString.call(c)!="[object Function]")throw new TypeError; | ||
b[d]===c)return d;return-1};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(c){if(this===void 0||this===null)throw new TypeError;var b=Object(this),a=b.length>>>0;if(!a)return-1;var d=a-1;arguments.length>0&&(d=u(arguments[1]));for(d=d>=0?d:Math.max(a-Math.abs(d),0);d>=0;d--)if(d in b&&c===b[d])return d;return-1};if(!Object.getPrototypeOf)Object.getPrototypeOf=function(c){return c.__proto__||c.constructor.prototype};if(!Object.getOwnPropertyDescriptor)Object.getOwnPropertyDescriptor= | ||
function(c,b){if(typeof c!="object"&&typeof c!="function"||c===null)throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object: "+c);if(!i(c,b))return l;var a,d,e;a={enumerable:!0,configurable:!0};if(n){var k=c.__proto__;c.__proto__=h;d=p(c,b);e=q(c,b);c.__proto__=k;if(d||e){if(d)a.get=d;if(e)a.set=e;return a}}a.value=c[b];return a};if(!Object.getOwnPropertyNames)Object.getOwnPropertyNames=function(c){return Object.keys(c)};if(!Object.create)Object.create=function(c,b){var a;if(c=== | ||
function(c,b){if(typeof c!="object"&&typeof c!="function"||c===null)throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object: "+c);if(!h(c,b))return m;var a,d,e;a={enumerable:!0,configurable:!0};if(n){var j=c.__proto__;c.__proto__=g;d=p(c,b);e=q(c,b);c.__proto__=j;if(d||e){if(d)a.get=d;if(e)a.set=e;return a}}a.value=c[b];return a};if(!Object.getOwnPropertyNames)Object.getOwnPropertyNames=function(c){return Object.keys(c)};if(!Object.create)Object.create=function(c,b){var a;if(c=== | ||
null)a={__proto__:null};else{if(typeof c!="object")throw new TypeError("typeof prototype["+typeof c+"] != 'object'");a=function(){};a.prototype=c;a=new a;a.__proto__=c}typeof b!="undefined"&&Object.defineProperties(a,b);return a};var r=Object.defineProperty;if(f=!!r)f={},Object.defineProperty(f,"",{}),f=""in f;if(!f)Object.defineProperty=function(c,b,a){if(typeof c!="object"&&typeof c!="function")throw new TypeError("Object.defineProperty called on non-object: "+c);if(typeof a!="object"||a===null)throw new TypeError("Property description must be an object: "+ | ||
a);if(r&&c.nodeType)return r(c,b,a);if(i(a,"value"))if(n&&(p(c,b)||q(c,b))){var d=c.__proto__;c.__proto__=h;delete c[b];c[b]=a.value;c.__proto__=d}else c[b]=a.value;else{if(!n)throw new TypeError("getters & setters can not be defined on this javascript engine");i(a,"get")&&s(c,b,a.get);i(a,"set")&&t(c,b,a.set)}return c};if(!Object.defineProperties)Object.defineProperties=function(c,b){for(var a in b)i(b,a)&&Object.defineProperty(c,a,b[a]);return c};if(!Object.seal)Object.seal=function(c){return c}; | ||
a);if(r&&c.nodeType)return r(c,b,a);if(h(a,"value"))if(n&&(p(c,b)||q(c,b))){var d=c.__proto__;c.__proto__=g;delete c[b];c[b]=a.value;c.__proto__=d}else c[b]=a.value;else{if(!n)throw new TypeError("getters & setters can not be defined on this javascript engine");h(a,"get")&&s(c,b,a.get);h(a,"set")&&t(c,b,a.set)}return c};if(!Object.defineProperties)Object.defineProperties=function(c,b){for(var a in b)h(b,a)&&Object.defineProperty(c,a,b[a]);return c};if(!Object.seal)Object.seal=function(c){return c}; | ||
if(!Object.freeze)Object.freeze=function(c){return c};try{Object.freeze(function(){})}catch(B){Object.freeze=function(c){return function(b){return typeof b=="function"?b:c(b)}}(Object.freeze)}if(!Object.preventExtensions)Object.preventExtensions=function(c){return c};if(!Object.isSealed)Object.isSealed=function(){return!1};if(!Object.isFrozen)Object.isFrozen=function(){return!1};if(!Object.isExtensible)Object.isExtensible=function(){return!0};if(!Object.keys){var v=!0,w="toString,toLocaleString,valueOf,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,constructor".split(","), | ||
x=w.length,y;for(y in{toString:null})v=!1;Object.keys=function b(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)i(a,d)&&b.push(d);if(v)for(d=0;d<x;d++){var e=w[d];i(a,e)&&b.push(e)}return b}}if(!Date.prototype.toISOString)Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+m(this.getUTCMonth()+1)+"-"+m(this.getUTCDate())+"T"+m(this.getUTCHours())+":"+m(this.getUTCMinutes())+":"+m(this.getUTCSeconds())+ | ||
"Z"};if(!Date.now)Date.now=function(){return(new Date).getTime()};if(!Date.prototype.toJSON)Date.prototype.toJSON=function(){if(typeof this.toISOString.call!="function")throw new TypeError;return this.toISOString.call(this)};isNaN(Date.parse("2011-06-15T21:40:05+06:00"))&&(Date=function(b){var a=function(d,e,f,g,h,i,l){var j=arguments.length;return this instanceof b?(j=j==1&&String(d)===d?new b(a.parse(d)):j>=7?new b(d,e,f,g,h,i,l):j>=6?new b(d,e,f,g,h,i):j>=5?new b(d,e,f,g,h):j>=4?new b(d,e,f,g): | ||
j>=3?new b(d,e,f):j>=2?new b(d,e):j>=1?new b(d):new b,j.constructor=a,j):b.apply(this,arguments)},d=RegExp("^(?:((?:[+-]\\d\\d)?\\d\\d\\d\\d)(?:-(\\d\\d)(?:-(\\d\\d))?)?)?(?:T(\\d\\d):(\\d\\d)(?::(\\d\\d)(?:\\.(\\d\\d\\d))?)?)?(?:Z|([+-])(\\d\\d):(\\d\\d))?$"),e;for(e in b)a[e]=b[e];a.now=b.now;a.UTC=b.UTC;a.prototype=b.prototype;a.prototype.constructor=a;a.parse=function(a){var e=d.exec(a);if(e){e.shift();for(var f=e[0]===l,g=0;g<10;g++)g!=7&&(e[g]=+(e[g]||(g<3?1:0)),g==1&&e[g]--);if(f)return((e[3]* | ||
60+e[4])*60+e[5])*1E3+e[6];f=(e[8]*60+e[9])*6E4;e[6]=="-"&&(f=-f);return b.UTC.apply(this,e.slice(0,7))+f}return b.parse.apply(this,arguments)};return a}(Date));if(!String.prototype.trim){var z=RegExp("^[\t\n-\r \u00a0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\u2028\u2029\ufeff][\t\n-\r \u00a0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\u2028\u2029\ufeff]*"),A=RegExp("[\t\n-\r \u00a0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\u2028\u2029\ufeff][\t\n-\r \u00a0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\u2028\u2029\ufeff]*$"); | ||
String.prototype.trim=function(){return String(this).replace(z,"").replace(A,"")}}var u=function(b){b=+b;b!==b?b=-1:b!==0&&b!==1/0&&b!==-(1/0)&&(b=(b>0||-1)*Math.floor(Math.abs(b)));return b}}); | ||
x=w.length,y;for(y in{toString:null})v=!1;Object.keys=function b(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)h(a,d)&&b.push(d);if(v)for(d=0;d<x;d++){var e=w[d];h(a,e)&&b.push(e)}return b}}if(!Date.prototype.toISOString)Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+ | ||
"Z"};if(!Date.now)Date.now=function(){return(new Date).getTime()};if(!Date.prototype.toJSON)Date.prototype.toJSON=function(){if(typeof this.toISOString.call!="function")throw new TypeError;return this.toISOString.call(this)};isNaN(Date.parse("2011-06-15T21:40:05+06:00"))&&(Date=function(b){var a=function(d,e,l,f,g,h,k){var i=arguments.length;return this instanceof b?(i=i==1&&String(d)===d?new b(a.parse(d)):i>=7?new b(d,e,l,f,g,h,k):i>=6?new b(d,e,l,f,g,h):i>=5?new b(d,e,l,f,g):i>=4?new b(d,e,l,f): | ||
i>=3?new b(d,e,l):i>=2?new b(d,e):i>=1?new b(d):new b,i.constructor=a,i):b.apply(this,arguments)},d=RegExp("^(d{4})(?:-(d{2})(?:-(d{2})(?:T(d{2}):(d{2})(?::(d{2})(?:.(d{3}))?)?(?:Z|(?:([-+])(d{2}):(d{2})))?)?)?)?$"),e;for(e in b)a[e]=b[e];a.now=b.now;a.UTC=b.UTC;a.prototype=b.prototype;a.prototype.constructor=a;a.parse=function(a){var e=d.exec(a);if(e){e.shift();for(var f=1;f<7;f++)e[f]=+(e[f]||(f<3?1:0)),f==1&&e[f]--;e.pop();var f=+e.pop(),g=e.pop(),h=0;if(g){if(f>23||minuteOffset>59)return NaN; | ||
h=(f*60+minuteOffset)*6E4*(g=="+"?-1:1)}return b.UTC.apply(this,e)+h}return b.parse.apply(this,arguments)};return a}(Date));if(!String.prototype.trim){var z=RegExp("^[\t\n-\r \u00a0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\u2028\u2029\ufeff][\t\n-\r \u00a0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\u2028\u2029\ufeff]*"),A=RegExp("[\t\n-\r \u00a0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\u2028\u2029\ufeff][\t\n-\r \u00a0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\u2028\u2029\ufeff]*$");String.prototype.trim= | ||
function(){return String(this).replace(z,"").replace(A,"")}}var u=function(b){b=+b;b!==b?b=-1:b!==0&&b!==1/0&&b!==-(1/0)&&(b=(b>0||-1)*Math.floor(Math.abs(b)));return b}}); |
{ | ||
"name": "es5-shim", | ||
"version": "1.2.4", | ||
"version": "1.2.6", | ||
"description": "ES5 as implementable on previous engines", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/kriskowal/es5-shim/", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
198069
5017