Comparing version 4.0.1 to 4.0.4
{ | ||
"additionalRules": [], | ||
"additionalRules": [], | ||
"disallowImplicitTypeConversion": ["binary", "string"], | ||
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], | ||
"disallowKeywords": ["with", "eval"], | ||
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], | ||
"disallowKeywordsOnNewLine": ["else"], | ||
"disallowSpaceAfterKeywords": [], | ||
"disallowMultipleLineStrings": true, | ||
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, | ||
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, | ||
"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, | ||
"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, | ||
"disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, | ||
"disallowQuotedKeysInObjects": "allButReserved", | ||
"disallowSpacesInsideParentheses": true, | ||
"disallowSpaceAfterBinaryOperators": [], | ||
"disallowSpacesInsideArrayBrackets": true, | ||
"disallowSpaceAfterKeywords": [], | ||
"disallowQuotedKeysInObjects": "allButReserved", | ||
"disallowSpaceAfterObjectKeys": true, | ||
"disallowSpaceAfterObjectKeys": true, | ||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], | ||
"requireCommaBeforeLineBreak": true, | ||
"disallowSpaceBeforeBinaryOperators": [], | ||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], | ||
"requireSpaceAfterPrefixUnaryOperators": [], | ||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], | ||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], | ||
"requireSpaceBeforePostfixUnaryOperators": [], | ||
"disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, | ||
"disallowSpaceBeforeBinaryOperators": [], | ||
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], | ||
"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, | ||
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], | ||
"disallowSpaceAfterBinaryOperators": [], | ||
"disallowSpacesInsideArrayBrackets": true, | ||
"disallowImplicitTypeConversion": ["binary", "string"], | ||
"disallowSpacesInsideParentheses": true, | ||
"disallowKeywords": ["with", "eval"], | ||
"disallowTrailingWhitespace": true, | ||
"requireKeywordsOnNewLine": [], | ||
"disallowKeywordsOnNewLine": ["else"], | ||
"excludeFiles": ["node_modules/**", "vendor/**"], | ||
"requireLineFeedAtFileEnd": true, | ||
"requireCommaBeforeLineBreak": true, | ||
"disallowTrailingWhitespace": true, | ||
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], | ||
"disallowTrailingComma": true, | ||
"requireKeywordsOnNewLine": [], | ||
"excludeFiles": ["node_modules/**", "vendor/**"], | ||
"requireLineFeedAtFileEnd": true, | ||
"disallowMultipleLineStrings": true, | ||
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], | ||
"requireDotNotation": true, | ||
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], | ||
"requireParenthesesAroundIIFE": true, | ||
"requireSpaceAfterPrefixUnaryOperators": [], | ||
"validateLineBreaks": "LF", | ||
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], | ||
"validateQuoteMarks": { | ||
"escape": true, | ||
"mark": "'" | ||
}, | ||
"requireSpaceBeforePostfixUnaryOperators": [], | ||
"disallowOperatorBeforeLineBreak": [], | ||
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, | ||
"requireSpaceBeforeKeywords": [ | ||
"do", | ||
"for", | ||
"if", | ||
"else", | ||
"switch", | ||
"case", | ||
"try", | ||
"catch", | ||
"finally", | ||
"while", | ||
"with", | ||
"return" | ||
] | ||
} | ||
"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, | ||
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, | ||
"validateLineBreaks": "LF" | ||
} |
{ | ||
"name": "es5-shim", | ||
"version": "4.0.1", | ||
"version": "4.0.4", | ||
"main": "es5-shim.js", | ||
@@ -22,4 +22,3 @@ "repository": { | ||
"es5", | ||
"es5", | ||
"shim", | ||
"es5 shim", | ||
"javascript", | ||
@@ -26,0 +25,0 @@ "ecmascript", |
@@ -5,8 +5,7 @@ { | ||
"description": "ECMAScript 5 compatibility shims for legacy JavaScript engines", | ||
"version": "v4.0.1", | ||
"version": "v4.0.4", | ||
"keywords": [ | ||
"shim", | ||
"es5", | ||
"es5", | ||
"shim", | ||
"es5 shim", | ||
"javascript", | ||
@@ -13,0 +12,0 @@ "ecmascript", |
@@ -15,2 +15,4 @@ /*! | ||
(function (root, factory) { | ||
'use strict'; | ||
/*global define, exports, module */ | ||
if (typeof define === 'function' && define.amd) { | ||
@@ -39,3 +41,3 @@ // AMD. Register as an anonymous module. | ||
var lookupSetter; | ||
var supportsAccessors = owns(prototypeOfObject, "__defineGetter__"); | ||
var supportsAccessors = owns(prototypeOfObject, '__defineGetter__'); | ||
if (supportsAccessors) { | ||
@@ -76,6 +78,3 @@ defineGetter = call.bind(prototypeOfObject.__defineGetter__); | ||
object.sentinel = 0; | ||
return Object.getOwnPropertyDescriptor( | ||
object, | ||
"sentinel" | ||
).value === 0; | ||
return Object.getOwnPropertyDescriptor(object, 'sentinel').value === 0; | ||
} catch (exception) { | ||
@@ -90,4 +89,4 @@ // returns falsy | ||
var getOwnPropertyDescriptorWorksOnObject = doesGetOwnPropertyDescriptorWork({}); | ||
var getOwnPropertyDescriptorWorksOnDom = typeof document === "undefined" || | ||
doesGetOwnPropertyDescriptorWork(document.createElement("div")); | ||
var getOwnPropertyDescriptorWorksOnDom = typeof document === 'undefined' || | ||
doesGetOwnPropertyDescriptorWork(document.createElement('div')); | ||
if (!getOwnPropertyDescriptorWorksOnDom || !getOwnPropertyDescriptorWorksOnObject) { | ||
@@ -99,6 +98,6 @@ var getOwnPropertyDescriptorFallback = Object.getOwnPropertyDescriptor; | ||
if (!Object.getOwnPropertyDescriptor || getOwnPropertyDescriptorFallback) { | ||
var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a non-object: "; | ||
var ERR_NON_OBJECT = 'Object.getOwnPropertyDescriptor called on a non-object: '; | ||
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { | ||
if ((typeof object !== "object" && typeof object !== "function") || object === null) { | ||
if ((typeof object !== 'object' && typeof object !== 'function') || object === null) { | ||
throw new TypeError(ERR_NON_OBJECT + object); | ||
@@ -124,3 +123,3 @@ } | ||
// `configurable`. | ||
var descriptor = { enumerable: true, configurable: true }; | ||
var descriptor = { enumerable: true, configurable: true }; | ||
@@ -187,9 +186,10 @@ // If JS engine supports accessor properties then property may be a | ||
var createEmpty; | ||
var supportsProto = !({__proto__:null} instanceof Object); | ||
var supportsProto = !({ __proto__: null } instanceof Object); | ||
// the following produces false positives | ||
// in Opera Mini => not a reliable check | ||
// Object.prototype.__proto__ === null | ||
/*global document */ | ||
if (supportsProto || typeof document === 'undefined') { | ||
createEmpty = function () { | ||
return { "__proto__": null }; | ||
return { __proto__: null }; | ||
}; | ||
@@ -238,3 +238,3 @@ } else { | ||
} else { | ||
if (typeof prototype !== "object" && typeof prototype !== "function") { | ||
if (typeof prototype !== 'object' && typeof prototype !== 'function') { | ||
// In the native implementation `parent` can be `null` | ||
@@ -245,3 +245,3 @@ // OR *any* `instanceof Object` (Object|Function|Array|RegExp|etc) | ||
// is...err...probably inappropriate, but the native version allows for it. | ||
throw new TypeError("Object prototype may only be an Object or null"); // same msg as Chrome | ||
throw new TypeError('Object prototype may only be an Object or null'); // same msg as Chrome | ||
} | ||
@@ -279,4 +279,4 @@ Type.prototype = prototype; | ||
try { | ||
Object.defineProperty(object, "sentinel", {}); | ||
return "sentinel" in object; | ||
Object.defineProperty(object, 'sentinel', {}); | ||
return 'sentinel' in object; | ||
} catch (exception) { | ||
@@ -291,4 +291,4 @@ // returns falsy | ||
var definePropertyWorksOnObject = doesDefinePropertyWork({}); | ||
var definePropertyWorksOnDom = typeof document === "undefined" || | ||
doesDefinePropertyWork(document.createElement("div")); | ||
var definePropertyWorksOnDom = typeof document === 'undefined' || | ||
doesDefinePropertyWork(document.createElement('div')); | ||
if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { | ||
@@ -301,12 +301,11 @@ var definePropertyFallback = Object.defineProperty, | ||
if (!Object.defineProperty || definePropertyFallback) { | ||
var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; | ||
var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " | ||
var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + | ||
"on this javascript engine"; | ||
var ERR_NON_OBJECT_DESCRIPTOR = 'Property description must be an object: '; | ||
var ERR_NON_OBJECT_TARGET = 'Object.defineProperty called on non-object: '; | ||
var ERR_ACCESSORS_NOT_SUPPORTED = 'getters & setters can not be defined on this javascript engine'; | ||
Object.defineProperty = function defineProperty(object, property, descriptor) { | ||
if ((typeof object !== "object" && typeof object !== "function") || object === null) { | ||
if ((typeof object !== 'object' && typeof object !== 'function') || object === null) { | ||
throw new TypeError(ERR_NON_OBJECT_TARGET + object); | ||
} | ||
if ((typeof descriptor !== "object" && typeof descriptor !== "function") || descriptor === null) { | ||
if ((typeof descriptor !== 'object' && typeof descriptor !== 'function') || descriptor === null) { | ||
throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); | ||
@@ -325,4 +324,4 @@ } | ||
// If it's a data property. | ||
if (owns(descriptor, "value")) { | ||
// fail silently if "writable", "enumerable", or "configurable" | ||
if (owns(descriptor, 'value')) { | ||
// fail silently if 'writable', 'enumerable', or 'configurable' | ||
// are requested but not supported | ||
@@ -332,15 +331,12 @@ /* | ||
if ( // can't implement these features; allow false but not true | ||
!(owns(descriptor, "writable") ? descriptor.writable : true) || | ||
!(owns(descriptor, "enumerable") ? descriptor.enumerable : true) || | ||
!(owns(descriptor, "configurable") ? descriptor.configurable : true) | ||
!(owns(descriptor, 'writable') ? descriptor.writable : true) || | ||
!(owns(descriptor, 'enumerable') ? descriptor.enumerable : true) || | ||
!(owns(descriptor, 'configurable') ? descriptor.configurable : true) | ||
) | ||
throw new RangeError( | ||
"This implementation of Object.defineProperty does not " + | ||
"support configurable, enumerable, or writable." | ||
'This implementation of Object.defineProperty does not support configurable, enumerable, or writable.' | ||
); | ||
*/ | ||
if (supportsAccessors && (lookupGetter(object, property) || | ||
lookupSetter(object, property))) | ||
{ | ||
if (supportsAccessors && (lookupGetter(object, property) || lookupSetter(object, property))) { | ||
// As accessors are supported only on engines implementing | ||
@@ -366,6 +362,6 @@ // `__proto__` we can safely override `__proto__` while defining | ||
// If we got that far then getters and setters can be defined !! | ||
if (owns(descriptor, "get")) { | ||
if (owns(descriptor, 'get')) { | ||
defineGetter(object, property, descriptor.get); | ||
} | ||
if (owns(descriptor, "set")) { | ||
if (owns(descriptor, 'set')) { | ||
defineSetter(object, property, descriptor.set); | ||
@@ -392,3 +388,3 @@ } | ||
for (var property in properties) { | ||
if (owns(properties, property) && property !== "__proto__") { | ||
if (owns(properties, property) && property !== '__proto__') { | ||
Object.defineProperty(object, property, properties[property]); | ||
@@ -429,3 +425,3 @@ } | ||
return function freeze(object) { | ||
if (typeof object === "function") { | ||
if (typeof object === 'function') { | ||
return object; | ||
@@ -436,3 +432,3 @@ } else { | ||
}; | ||
})(Object.freeze); | ||
}(Object.freeze)); | ||
} | ||
@@ -488,2 +484,1 @@ | ||
})); | ||
/*! | ||
* https://github.com/es-shims/es5-shim | ||
* @license es5-shim Copyright 2009-2014 by contributors, MIT License | ||
* see https://github.com/es-shims/es5-shim/blob/master/LICENSE | ||
* see https://github.com/es-shims/es5-shim/blob/v4.0.4/LICENSE | ||
*/ | ||
(function(e,t){if(typeof define==="function"&&define.amd){define(t)}else if(typeof exports==="object"){module.exports=t()}else{e.returnExports=t()}})(this,function(){var e=Function.prototype.call;var t=Object.prototype;var r=e.bind(t.hasOwnProperty);var n;var o;var i;var c;var f=r(t,"__defineGetter__");if(f){n=e.bind(t.__defineGetter__);o=e.bind(t.__defineSetter__);i=e.bind(t.__lookupGetter__);c=e.bind(t.__lookupSetter__)}if(!Object.getPrototypeOf){Object.getPrototypeOf=function g(e){var r=e.__proto__;if(r||r===null){return r}else if(e.constructor){return e.constructor.prototype}else{return t}}}function u(e){try{e.sentinel=0;return Object.getOwnPropertyDescriptor(e,"sentinel").value===0}catch(t){}}if(Object.defineProperty){var p=u({});var a=typeof document==="undefined"||u(document.createElement("div"));if(!a||!p){var l=Object.getOwnPropertyDescriptor}}if(!Object.getOwnPropertyDescriptor||l){var b="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function E(e,n){if(typeof e!=="object"&&typeof e!=="function"||e===null){throw new TypeError(b+e)}if(l){try{return l.call(Object,e,n)}catch(o){}}if(!r(e,n)){return}var u={enumerable:true,configurable:true};if(f){var p=e.__proto__;var a=e!==t;if(a){e.__proto__=t}var _=i(e,n);var s=c(e,n);if(a){e.__proto__=p}if(_||s){if(_){u.get=_}if(s){u.set=s}return u}}u.value=e[n];u.writable=true;return u}}if(!Object.getOwnPropertyNames){Object.getOwnPropertyNames=function x(e){return Object.keys(e)}}if(!Object.create){var _;var s=!({__proto__:null}instanceof Object);if(s||typeof document==="undefined"){_=function(){return{__proto__:null}}}else{_=function(){var e=document.createElement("iframe");var t=document.body||document.documentElement;e.style.display="none";t.appendChild(e);e.src="javascript:";var r=e.contentWindow.Object.prototype;t.removeChild(e);e=null;delete r.constructor;delete r.hasOwnProperty;delete r.propertyIsEnumerable;delete r.isPrototypeOf;delete r.toLocaleString;delete r.toString;delete r.valueOf;r.__proto__=null;function n(){}n.prototype=r;_=function(){return new n};return new n}}Object.create=function z(e,t){var r;function n(){}if(e===null){r=_()}else{if(typeof e!=="object"&&typeof e!=="function"){throw new TypeError("Object prototype may only be an Object or null")}n.prototype=e;r=new n;r.__proto__=e}if(t!==void 0){Object.defineProperties(r,t)}return r}}function d(e){try{Object.defineProperty(e,"sentinel",{});return"sentinel"in e}catch(t){}}if(Object.defineProperty){var y=d({});var O=typeof document==="undefined"||d(document.createElement("div"));if(!y||!O){var j=Object.defineProperty,v=Object.defineProperties}}if(!Object.defineProperty||j){var w="Property description must be an object: ";var P="Object.defineProperty called on non-object: ";var m="getters & setters can not be defined "+"on this javascript engine";Object.defineProperty=function S(e,u,p){if(typeof e!=="object"&&typeof e!=="function"||e===null){throw new TypeError(P+e)}if(typeof p!=="object"&&typeof p!=="function"||p===null){throw new TypeError(w+p)}if(j){try{return j.call(Object,e,u,p)}catch(a){}}if(r(p,"value")){if(f&&(i(e,u)||c(e,u))){var l=e.__proto__;e.__proto__=t;delete e[u];e[u]=p.value;e.__proto__=l}else{e[u]=p.value}}else{if(!f){throw new TypeError(m)}if(r(p,"get")){n(e,u,p.get)}if(r(p,"set")){o(e,u,p.set)}}return e}}if(!Object.defineProperties||v){Object.defineProperties=function T(e,t){if(v){try{return v.call(Object,e,t)}catch(n){}}for(var o in t){if(r(t,o)&&o!=="__proto__"){Object.defineProperty(e,o,t[o])}}return e}}if(!Object.seal){Object.seal=function D(e){return e}}if(!Object.freeze){Object.freeze=function k(e){return e}}try{Object.freeze(function(){})}catch(h){Object.freeze=function F(e){return function t(r){if(typeof r==="function"){return r}else{return e(r)}}}(Object.freeze)}if(!Object.preventExtensions){Object.preventExtensions=function G(e){return e}}if(!Object.isSealed){Object.isSealed=function C(e){return false}}if(!Object.isFrozen){Object.isFrozen=function N(e){return false}}if(!Object.isExtensible){Object.isExtensible=function I(e){if(Object(e)!==e){throw new TypeError}var t="";while(r(e,t)){t+="?"}e[t]=true;var n=r(e,t);delete e[t];return n}}}); | ||
(function(e,t){"use strict";if(typeof define==="function"&&define.amd){define(t)}else if(typeof exports==="object"){module.exports=t()}else{e.returnExports=t()}})(this,function(){var e=Function.prototype.call;var t=Object.prototype;var r=e.bind(t.hasOwnProperty);var n;var o;var i;var c;var f=r(t,"__defineGetter__");if(f){n=e.bind(t.__defineGetter__);o=e.bind(t.__defineSetter__);i=e.bind(t.__lookupGetter__);c=e.bind(t.__lookupSetter__)}if(!Object.getPrototypeOf){Object.getPrototypeOf=function g(e){var r=e.__proto__;if(r||r===null){return r}else if(e.constructor){return e.constructor.prototype}else{return t}}}function u(e){try{e.sentinel=0;return Object.getOwnPropertyDescriptor(e,"sentinel").value===0}catch(t){}}if(Object.defineProperty){var p=u({});var a=typeof document==="undefined"||u(document.createElement("div"));if(!a||!p){var l=Object.getOwnPropertyDescriptor}}if(!Object.getOwnPropertyDescriptor||l){var b="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function E(e,n){if(typeof e!=="object"&&typeof e!=="function"||e===null){throw new TypeError(b+e)}if(l){try{return l.call(Object,e,n)}catch(o){}}if(!r(e,n)){return}var u={enumerable:true,configurable:true};if(f){var p=e.__proto__;var a=e!==t;if(a){e.__proto__=t}var s=i(e,n);var _=c(e,n);if(a){e.__proto__=p}if(s||_){if(s){u.get=s}if(_){u.set=_}return u}}u.value=e[n];u.writable=true;return u}}if(!Object.getOwnPropertyNames){Object.getOwnPropertyNames=function x(e){return Object.keys(e)}}if(!Object.create){var s;var _=!({__proto__:null}instanceof Object);if(_||typeof document==="undefined"){s=function(){return{__proto__:null}}}else{s=function(){var e=document.createElement("iframe");var t=document.body||document.documentElement;e.style.display="none";t.appendChild(e);e.src="javascript:";var r=e.contentWindow.Object.prototype;t.removeChild(e);e=null;delete r.constructor;delete r.hasOwnProperty;delete r.propertyIsEnumerable;delete r.isPrototypeOf;delete r.toLocaleString;delete r.toString;delete r.valueOf;r.__proto__=null;function n(){}n.prototype=r;s=function(){return new n};return new n}}Object.create=function z(e,t){var r;function n(){}if(e===null){r=s()}else{if(typeof e!=="object"&&typeof e!=="function"){throw new TypeError("Object prototype may only be an Object or null")}n.prototype=e;r=new n;r.__proto__=e}if(t!==void 0){Object.defineProperties(r,t)}return r}}function d(e){try{Object.defineProperty(e,"sentinel",{});return"sentinel"in e}catch(t){}}if(Object.defineProperty){var y=d({});var O=typeof document==="undefined"||d(document.createElement("div"));if(!y||!O){var j=Object.defineProperty,v=Object.defineProperties}}if(!Object.defineProperty||j){var w="Property description must be an object: ";var P="Object.defineProperty called on non-object: ";var m="getters & setters can not be defined on this javascript engine";Object.defineProperty=function S(e,u,p){if(typeof e!=="object"&&typeof e!=="function"||e===null){throw new TypeError(P+e)}if(typeof p!=="object"&&typeof p!=="function"||p===null){throw new TypeError(w+p)}if(j){try{return j.call(Object,e,u,p)}catch(a){}}if(r(p,"value")){if(f&&(i(e,u)||c(e,u))){var l=e.__proto__;e.__proto__=t;delete e[u];e[u]=p.value;e.__proto__=l}else{e[u]=p.value}}else{if(!f){throw new TypeError(m)}if(r(p,"get")){n(e,u,p.get)}if(r(p,"set")){o(e,u,p.set)}}return e}}if(!Object.defineProperties||v){Object.defineProperties=function T(e,t){if(v){try{return v.call(Object,e,t)}catch(n){}}for(var o in t){if(r(t,o)&&o!=="__proto__"){Object.defineProperty(e,o,t[o])}}return e}}if(!Object.seal){Object.seal=function D(e){return e}}if(!Object.freeze){Object.freeze=function k(e){return e}}try{Object.freeze(function(){})}catch(h){Object.freeze=function F(e){return function t(r){if(typeof r==="function"){return r}else{return e(r)}}}(Object.freeze)}if(!Object.preventExtensions){Object.preventExtensions=function G(e){return e}}if(!Object.isSealed){Object.isSealed=function C(e){return false}}if(!Object.isFrozen){Object.isFrozen=function N(e){return false}}if(!Object.isExtensible){Object.isExtensible=function I(e){if(Object(e)!==e){throw new TypeError}var t="";while(r(e,t)){t+="?"}e[t]=true;var n=r(e,t);delete e[t];return n}}}); | ||
//# sourceMappingURL=es5-sham.map |
314
es5-shim.js
@@ -9,8 +9,9 @@ /*! | ||
//Add semicolon to prevent IIFE from being passed as argument to concated code. | ||
; | ||
// UMD (Universal Module Definition) | ||
// see https://github.com/umdjs/umd/blob/master/returnExports.js | ||
(function (root, factory) { | ||
// Add semicolon to prevent IIFE from being passed as argument to concatenated code. | ||
;(function (root, factory) { | ||
'use strict'; | ||
/*global define, exports, module */ | ||
if (typeof define === 'function' && define.amd) { | ||
@@ -46,3 +47,3 @@ // AMD. Register as an anonymous module. | ||
var NumberPrototype = Number.prototype; | ||
var _Array_slice_ = ArrayPrototype.slice; | ||
var array_slice = ArrayPrototype.slice; | ||
var array_splice = ArrayPrototype.splice; | ||
@@ -53,27 +54,27 @@ var array_push = ArrayPrototype.push; | ||
// Having a toString local variable name breaks in Opera so use _toString. | ||
var _toString = ObjectPrototype.toString; | ||
// Having a toString local variable name breaks in Opera so use to_string. | ||
var to_string = ObjectPrototype.toString; | ||
var isFunction = function (val) { | ||
return ObjectPrototype.toString.call(val) === '[object Function]'; | ||
return to_string.call(val) === '[object Function]'; | ||
}; | ||
var isRegex = function (val) { | ||
return ObjectPrototype.toString.call(val) === '[object RegExp]'; | ||
return to_string.call(val) === '[object RegExp]'; | ||
}; | ||
var isArray = function isArray(obj) { | ||
return _toString.call(obj) === "[object Array]"; | ||
return to_string.call(obj) === '[object Array]'; | ||
}; | ||
var isString = function isString(obj) { | ||
return _toString.call(obj) === "[object String]"; | ||
return to_string.call(obj) === '[object String]'; | ||
}; | ||
var isArguments = function isArguments(value) { | ||
var str = _toString.call(value); | ||
var str = to_string.call(value); | ||
var isArgs = str === '[object Arguments]'; | ||
if (!isArgs) { | ||
isArgs = !isArray(value) | ||
&& value !== null | ||
&& typeof value === 'object' | ||
&& typeof value.length === 'number' | ||
&& value.length >= 0 | ||
&& isFunction(value.callee); | ||
isArgs = !isArray(value) && | ||
value !== null && | ||
typeof value === 'object' && | ||
typeof value.length === 'number' && | ||
value.length >= 0 && | ||
isFunction(value.callee); | ||
} | ||
@@ -128,4 +129,4 @@ return isArgs; | ||
function toInteger(n) { | ||
n = +n; | ||
function toInteger(num) { | ||
var n = +num; | ||
if (n !== n) { // isNaN | ||
@@ -141,9 +142,7 @@ n = 0; | ||
var type = typeof input; | ||
return ( | ||
input === null || | ||
type === "undefined" || | ||
type === "boolean" || | ||
type === "number" || | ||
type === "string" | ||
); | ||
return input === null || | ||
type === 'undefined' || | ||
type === 'boolean' || | ||
type === 'number' || | ||
type === 'string'; | ||
} | ||
@@ -173,15 +172,17 @@ | ||
// ES5 9.9 | ||
// http://es5.github.com/#x9.9 | ||
var toObject = function (o) { | ||
if (o == null) { // this matches both null and undefined | ||
throw new TypeError("can't convert " + o + " to object"); | ||
var ES = { | ||
// ES5 9.9 | ||
// http://es5.github.com/#x9.9 | ||
ToObject: function (o) { | ||
/*jshint eqnull: true */ | ||
if (o == null) { // this matches both null and undefined | ||
throw new TypeError("can't convert " + o + ' to object'); | ||
} | ||
return Object(o); | ||
}, | ||
ToUint32: function ToUint32(x) { | ||
return x >>> 0; | ||
} | ||
return Object(o); | ||
}; | ||
var ToUint32 = function ToUint32(x) { | ||
return x >>> 0; | ||
}; | ||
// | ||
@@ -195,3 +196,3 @@ // Function | ||
function Empty() {} | ||
var Empty = function Empty() {}; | ||
@@ -204,3 +205,3 @@ defineProperties(FunctionPrototype, { | ||
if (!isFunction(target)) { | ||
throw new TypeError("Function.prototype.bind called on incompatible " + target); | ||
throw new TypeError('Function.prototype.bind called on incompatible ' + target); | ||
} | ||
@@ -210,3 +211,3 @@ // 3. Let A be a new (possibly empty) internal list of all of the | ||
// XXX slicedArgs will stand in for "A" if used | ||
var args = _Array_slice_.call(arguments, 1); // for normal call | ||
var args = array_slice.call(arguments, 1); // for normal call | ||
// 4. Let F be a new native ECMAScript object. | ||
@@ -221,2 +222,3 @@ // 11. Set the [[Prototype]] internal property of F to the standard | ||
// 15.3.4.5.3. | ||
var bound; | ||
var binder = function () { | ||
@@ -243,3 +245,3 @@ | ||
this, | ||
args.concat(_Array_slice_.call(arguments)) | ||
args.concat(array_slice.call(arguments)) | ||
); | ||
@@ -273,3 +275,3 @@ if (Object(result) === result) { | ||
that, | ||
args.concat(_Array_slice_.call(arguments)) | ||
args.concat(array_slice.call(arguments)) | ||
); | ||
@@ -293,3 +295,3 @@ | ||
for (var i = 0; i < boundLength; i++) { | ||
boundArgs.push("$" + i); | ||
boundArgs.push('$' + i); | ||
} | ||
@@ -303,3 +305,3 @@ | ||
// and so this code will never be executed. | ||
var bound = Function("binder", "return function (" + boundArgs.join(",") + "){return binder.apply(this,arguments)}")(binder); | ||
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder); | ||
@@ -342,15 +344,2 @@ if (target.prototype) { | ||
// If JS engine supports accessors creating shortcuts. | ||
var defineGetter; | ||
var defineSetter; | ||
var lookupGetter; | ||
var lookupSetter; | ||
var supportsAccessors; | ||
if ((supportsAccessors = owns(ObjectPrototype, "__defineGetter__"))) { | ||
defineGetter = call.bind(ObjectPrototype.__defineGetter__); | ||
defineSetter = call.bind(ObjectPrototype.__defineSetter__); | ||
lookupGetter = call.bind(ObjectPrototype.__lookupGetter__); | ||
lookupSetter = call.bind(ObjectPrototype.__lookupSetter__); | ||
} | ||
// | ||
@@ -390,3 +379,3 @@ // Array | ||
if (arguments.length > 0 && typeof deleteCount !== 'number') { | ||
args = _Array_slice_.call(arguments); | ||
args = array_slice.call(arguments); | ||
if (args.length < 2) { | ||
@@ -438,4 +427,4 @@ args.push(this.length - start); | ||
// and failure of `0 in boxedString` (Rhino) | ||
var boxedString = Object("a"); | ||
var splitString = boxedString[0] !== "a" || !(0 in boxedString); | ||
var boxedString = Object('a'); | ||
var splitString = boxedString[0] !== 'a' || !(0 in boxedString); | ||
@@ -461,3 +450,3 @@ var properlyBoxesContext = function properlyBoxed(method) { | ||
forEach: function forEach(fun /*, thisp*/) { | ||
var object = toObject(this), | ||
var object = ES.ToObject(this), | ||
self = splitString && isString(this) ? this.split('') : object, | ||
@@ -489,3 +478,3 @@ thisp = arguments[1], | ||
map: function map(fun /*, thisp*/) { | ||
var object = toObject(this), | ||
var object = ES.ToObject(this), | ||
self = splitString && isString(this) ? this.split('') : object, | ||
@@ -498,3 +487,3 @@ length = self.length >>> 0, | ||
if (!isFunction(fun)) { | ||
throw new TypeError(fun + " is not a function"); | ||
throw new TypeError(fun + ' is not a function'); | ||
} | ||
@@ -516,3 +505,3 @@ | ||
filter: function filter(fun /*, thisp */) { | ||
var object = toObject(this), | ||
var object = ES.ToObject(this), | ||
self = splitString && isString(this) ? this.split('') : object, | ||
@@ -526,3 +515,3 @@ length = self.length >>> 0, | ||
if (!isFunction(fun)) { | ||
throw new TypeError(fun + " is not a function"); | ||
throw new TypeError(fun + ' is not a function'); | ||
} | ||
@@ -547,3 +536,3 @@ | ||
every: function every(fun /*, thisp */) { | ||
var object = toObject(this), | ||
var object = ES.ToObject(this), | ||
self = splitString && isString(this) ? this.split('') : object, | ||
@@ -555,3 +544,3 @@ length = self.length >>> 0, | ||
if (!isFunction(fun)) { | ||
throw new TypeError(fun + " is not a function"); | ||
throw new TypeError(fun + ' is not a function'); | ||
} | ||
@@ -573,3 +562,3 @@ | ||
some: function some(fun /*, thisp */) { | ||
var object = toObject(this), | ||
var object = ES.ToObject(this), | ||
self = splitString && isString(this) ? this.split('') : object, | ||
@@ -581,3 +570,3 @@ length = self.length >>> 0, | ||
if (!isFunction(fun)) { | ||
throw new TypeError(fun + " is not a function"); | ||
throw new TypeError(fun + ' is not a function'); | ||
} | ||
@@ -603,3 +592,3 @@ | ||
reduce: function reduce(fun /*, initial*/) { | ||
var object = toObject(this), | ||
var object = ES.ToObject(this), | ||
self = splitString && isString(this) ? this.split('') : object, | ||
@@ -610,3 +599,3 @@ length = self.length >>> 0; | ||
if (!isFunction(fun)) { | ||
throw new TypeError(fun + " is not a function"); | ||
throw new TypeError(fun + ' is not a function'); | ||
} | ||
@@ -616,3 +605,3 @@ | ||
if (!length && arguments.length === 1) { | ||
throw new TypeError("reduce of empty array with no initial value"); | ||
throw new TypeError('reduce of empty array with no initial value'); | ||
} | ||
@@ -633,3 +622,3 @@ | ||
if (++i >= length) { | ||
throw new TypeError("reduce of empty array with no initial value"); | ||
throw new TypeError('reduce of empty array with no initial value'); | ||
} | ||
@@ -658,3 +647,3 @@ } while (true); | ||
reduceRight: function reduceRight(fun /*, initial*/) { | ||
var object = toObject(this), | ||
var object = ES.ToObject(this), | ||
self = splitString && isString(this) ? this.split('') : object, | ||
@@ -665,3 +654,3 @@ length = self.length >>> 0; | ||
if (!isFunction(fun)) { | ||
throw new TypeError(fun + " is not a function"); | ||
throw new TypeError(fun + ' is not a function'); | ||
} | ||
@@ -671,3 +660,3 @@ | ||
if (!length && arguments.length === 1) { | ||
throw new TypeError("reduceRight of empty array with no initial value"); | ||
throw new TypeError('reduceRight of empty array with no initial value'); | ||
} | ||
@@ -687,3 +676,3 @@ | ||
if (--i < 0) { | ||
throw new TypeError("reduceRight of empty array with no initial value"); | ||
throw new TypeError('reduceRight of empty array with no initial value'); | ||
} | ||
@@ -712,4 +701,4 @@ } while (true); | ||
defineProperties(ArrayPrototype, { | ||
indexOf: function indexOf(sought /*, fromIndex */ ) { | ||
var self = splitString && isString(this) ? this.split('') : toObject(this), | ||
indexOf: function indexOf(sought /*, fromIndex */) { | ||
var self = splitString && isString(this) ? this.split('') : ES.ToObject(this), | ||
length = self.length >>> 0; | ||
@@ -743,3 +732,3 @@ | ||
lastIndexOf: function lastIndexOf(sought /*, fromIndex */) { | ||
var self = splitString && isString(this) ? this.split('') : toObject(this), | ||
var self = splitString && isString(this) ? this.split('') : ES.ToObject(this), | ||
length = self.length >>> 0; | ||
@@ -775,11 +764,11 @@ | ||
var hasDontEnumBug = !({'toString': null}).propertyIsEnumerable('toString'), | ||
hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'), | ||
hasProtoEnumBug = function () {}.propertyIsEnumerable('prototype'), | ||
dontEnums = [ | ||
"toString", | ||
"toLocaleString", | ||
"valueOf", | ||
"hasOwnProperty", | ||
"isPrototypeOf", | ||
"propertyIsEnumerable", | ||
"constructor" | ||
'toString', | ||
'toLocaleString', | ||
'valueOf', | ||
'hasOwnProperty', | ||
'isPrototypeOf', | ||
'propertyIsEnumerable', | ||
'constructor' | ||
], | ||
@@ -796,3 +785,3 @@ dontEnumsLength = dontEnums.length; | ||
if (!isObject && !isFn && !isArgs) { | ||
throw new TypeError("Object.keys called on a non-object"); | ||
throw new TypeError('Object.keys called on a non-object'); | ||
} | ||
@@ -856,3 +845,3 @@ | ||
var negativeDate = -62198755200000; | ||
var negativeYearString = "-000001"; | ||
var negativeYearString = '-000001'; | ||
var hasNegativeDateBug = Date.prototype.toISOString && new Date(negativeDate).toISOString().indexOf(negativeYearString) === -1; | ||
@@ -864,3 +853,3 @@ | ||
if (!isFinite(this)) { | ||
throw new RangeError("Date.prototype.toISOString called on non-finite value."); | ||
throw new RangeError('Date.prototype.toISOString called on non-finite value.'); | ||
} | ||
@@ -878,4 +867,4 @@ | ||
year = ( | ||
(year < 0 ? "-" : (year > 9999 ? "+" : "")) + | ||
("00000" + Math.abs(year)).slice(0 <= year && year <= 9999 ? -4 : -6) | ||
(year < 0 ? '-' : (year > 9999 ? '+' : '')) + | ||
('00000' + Math.abs(year)).slice(0 <= year && year <= 9999 ? -4 : -6) | ||
); | ||
@@ -889,3 +878,3 @@ | ||
if (value < 10) { | ||
result[length] = "0" + value; | ||
result[length] = '0' + value; | ||
} | ||
@@ -895,5 +884,5 @@ } | ||
return ( | ||
year + "-" + result.slice(0, 2).join("-") + | ||
"T" + result.slice(2).join(":") + "." + | ||
("000" + this.getUTCMilliseconds()).slice(-3) + "Z" | ||
year + '-' + result.slice(0, 2).join('-') + | ||
'T' + result.slice(2).join(':') + '.' + | ||
('000' + this.getUTCMilliseconds()).slice(-3) + 'Z' | ||
); | ||
@@ -934,3 +923,3 @@ } | ||
// 3. If tv is a Number and is not finite, return null. | ||
if (typeof tv === "number" && !isFinite(tv)) { | ||
if (typeof tv === 'number' && !isFinite(tv)) { | ||
return null; | ||
@@ -942,4 +931,4 @@ } | ||
// 5. If IsCallable(toISO) is false, throw a TypeError exception. | ||
if (typeof toISO !== "function") { | ||
throw new TypeError("toISOString property is not callable"); | ||
if (typeof toISO !== 'function') { | ||
throw new TypeError('toISOString property is not callable'); | ||
} | ||
@@ -967,6 +956,7 @@ // 6. Return the result of calling the [[Call]] internal method of | ||
var acceptsInvalidDates = !isNaN(Date.parse('2012-04-04T24:00:00.500Z')) || !isNaN(Date.parse('2012-11-31T23:59:59.000Z')); | ||
var doesNotParseY2KNewYear = isNaN(Date.parse("2000-01-01T00:00:00.000Z")); | ||
var doesNotParseY2KNewYear = isNaN(Date.parse('2000-01-01T00:00:00.000Z')); | ||
if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) { | ||
// XXX global assignment won't work in embeddings that use | ||
// an alternate object for the context. | ||
/*global Date: true */ | ||
Date = (function (NativeDate) { | ||
@@ -999,23 +989,23 @@ | ||
// 15.9.1.15 Date Time String Format. | ||
var isoDateExpression = new RegExp("^" + | ||
"(\\d{4}|[\+\-]\\d{6})" + // four-digit year capture or sign + | ||
var isoDateExpression = new RegExp('^' + | ||
'(\\d{4}|[+-]\\d{6})' + // four-digit year capture or sign + | ||
// 6-digit extended year | ||
"(?:-(\\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{1,}))?" + // milliseconds capture | ||
")?" + | ||
"(" + // capture UTC offset component | ||
"Z|" + // UTC capture | ||
"(?:" + // offset specifier +/-hours:minutes | ||
"([-+])" + // sign capture | ||
"(\\d{2})" + // hours offset capture | ||
":(\\d{2})" + // minutes offset 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{1,}))?' + // milliseconds capture | ||
')?' + | ||
'(' + // capture UTC offset component | ||
'Z|' + // UTC capture | ||
'(?:' + // offset specifier +/-hours:minutes | ||
'([-+])' + // sign capture | ||
'(\\d{2})' + // hours offset capture | ||
':(\\d{2})' + // minutes offset capture | ||
')' + | ||
')?)?)?)?' + | ||
'$'); | ||
@@ -1070,3 +1060,3 @@ var months = [ | ||
isLocalTime = Boolean(match[4] && !match[8]), | ||
signOffset = match[9] === "-" ? 1 : -1, | ||
signOffset = match[9] === '-' ? 1 : -1, | ||
hourOffset = Number(match[10] || 0), | ||
@@ -1111,3 +1101,4 @@ minuteOffset = Number(match[11] || 0), | ||
return Date; | ||
})(Date); | ||
}(Date)); | ||
/*global Date: false */ | ||
} | ||
@@ -1132,6 +1123,6 @@ | ||
var hasToFixedBugs = NumberPrototype.toFixed && ( | ||
(0.00008).toFixed(3) !== '0.000' | ||
|| (0.9).toFixed(0) !== '1' | ||
|| (1.255).toFixed(2) !== '1.25' | ||
|| (1000000000000000128).toFixed(0) !== "1000000000000000128" | ||
(0.00008).toFixed(3) !== '0.000' || | ||
(0.9).toFixed(0) !== '1' || | ||
(1.255).toFixed(2) !== '1.25' || | ||
(1000000000000000128).toFixed(0) !== '1000000000000000128' | ||
); | ||
@@ -1200,3 +1191,3 @@ | ||
if (f < 0 || f > 20) { | ||
throw new RangeError("Number.toFixed called with invalid number of decimals"); | ||
throw new RangeError('Number.toFixed called with invalid number of decimals'); | ||
} | ||
@@ -1208,3 +1199,3 @@ | ||
if (x !== x) { | ||
return "NaN"; | ||
return 'NaN'; | ||
} | ||
@@ -1217,10 +1208,10 @@ | ||
s = ""; | ||
s = ''; | ||
if (x < 0) { | ||
s = "-"; | ||
s = '-'; | ||
x = -x; | ||
} | ||
m = "0"; | ||
m = '0'; | ||
@@ -1306,3 +1297,3 @@ if (x > 1e-21) { | ||
'.'.split(/(.?)(.?)/).length !== 4 || | ||
'tesst'.split(/(s)*/)[1] === "t" || | ||
'tesst'.split(/(s)*/)[1] === 't' || | ||
'test'.split(/(?:)/, -1).length !== 4 || | ||
@@ -1313,7 +1304,7 @@ ''.split(/.?/).length || | ||
(function () { | ||
var compliantExecNpcg = /()??/.exec("")[1] === void 0; // NPCG: nonparticipating capturing group | ||
var compliantExecNpcg = typeof (/()??/).exec('')[1] === 'undefined'; // NPCG: nonparticipating capturing group | ||
StringPrototype.split = function (separator, limit) { | ||
var string = this; | ||
if (separator === void 0 && limit === 0) { | ||
if (typeof separator === 'undefined' && limit === 0) { | ||
return []; | ||
@@ -1323,3 +1314,3 @@ } | ||
// If `separator` is not a regex, use native split | ||
if (_toString.call(separator) !== "[object RegExp]") { | ||
if (to_string.call(separator) !== '[object RegExp]') { | ||
return string_split.call(this, separator, limit); | ||
@@ -1329,14 +1320,14 @@ } | ||
var output = [], | ||
flags = (separator.ignoreCase ? "i" : "") + | ||
(separator.multiline ? "m" : "") + | ||
(separator.extended ? "x" : "") + // Proposed for ES6 | ||
(separator.sticky ? "y" : ""), // Firefox 3+ | ||
flags = (separator.ignoreCase ? 'i' : '') + | ||
(separator.multiline ? 'm' : '') + | ||
(separator.extended ? 'x' : '') + // Proposed for ES6 | ||
(separator.sticky ? 'y' : ''), // Firefox 3+ | ||
lastLastIndex = 0, | ||
// Make `global` and avoid `lastIndex` issues by working with a copy | ||
separator2, match, lastIndex, lastLength; | ||
separator = new RegExp(separator.source, flags + "g"); | ||
string += ""; // Type-convert | ||
separator = new RegExp(separator.source, flags + 'g'); | ||
string += ''; // Type-convert | ||
if (!compliantExecNpcg) { | ||
// Doesn't need flags gy, but they don't hurt | ||
separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags); | ||
separator2 = new RegExp('^' + separator.source + '$(?!\\s)', flags); | ||
} | ||
@@ -1350,5 +1341,5 @@ /* Values for `limit`, per the spec: | ||
*/ | ||
limit = limit === void 0 ? | ||
limit = typeof limit === 'undefined' ? | ||
-1 >>> 0 : // Math.pow(2, 32) - 1 | ||
ToUint32(limit); | ||
ES.ToUint32(limit); | ||
while (match = separator.exec(string)) { | ||
@@ -1364,3 +1355,3 @@ // `separator.lastIndex` is not reliable cross-browser | ||
for (var i = 1; i < arguments.length - 2; i++) { | ||
if (arguments[i] === void 0) { | ||
if (typeof arguments[i] === 'undefined') { | ||
match[i] = void 0; | ||
@@ -1372,3 +1363,3 @@ } | ||
if (match.length > 1 && match.index < string.length) { | ||
ArrayPrototype.push.apply(output, match.slice(1)); | ||
array_push.apply(output, match.slice(1)); | ||
} | ||
@@ -1386,4 +1377,4 @@ lastLength = match[0].length; | ||
if (lastLastIndex === string.length) { | ||
if (lastLength || !separator.test("")) { | ||
output.push(""); | ||
if (lastLength || !separator.test('')) { | ||
output.push(''); | ||
} | ||
@@ -1403,5 +1394,5 @@ } else { | ||
// "0".split(undefined, 0) -> [] | ||
} else if ("0".split(void 0, 0).length) { | ||
} else if ('0'.split(void 0, 0).length) { | ||
StringPrototype.split = function split(separator, limit) { | ||
if (separator === void 0 && limit === 0) { return []; } | ||
if (typeof separator === 'undefined' && limit === 0) { return []; } | ||
return string_split.call(this, separator, limit); | ||
@@ -1431,3 +1422,3 @@ }; | ||
searchValue.lastIndex = 0; | ||
var args = searchValue.exec(match); | ||
var args = searchValue.exec(match) || []; | ||
searchValue.lastIndex = originalLastIndex; | ||
@@ -1448,3 +1439,3 @@ args.push(arguments[length - 2], arguments[length - 1]); | ||
var string_substr = StringPrototype.substr; | ||
var hasNegativeSubstrBug = "".substr && "0b".substr(-1) !== "b"; | ||
var hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b'; | ||
defineProperties(StringPrototype, { | ||
@@ -1462,9 +1453,9 @@ substr: function substr(start, length) { | ||
// whitespace from: http://es5.github.io/#x15.5.4.20 | ||
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" + | ||
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + | ||
"\u2029\uFEFF"; | ||
var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + | ||
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + | ||
'\u2029\uFEFF'; | ||
var zeroWidth = '\u200b'; | ||
var wsRegexChars = "[" + ws + "]"; | ||
var trimBeginRegexp = new RegExp("^" + wsRegexChars + wsRegexChars + "*"); | ||
var trimEndRegexp = new RegExp(wsRegexChars + wsRegexChars + "*$"); | ||
var wsRegexChars = '[' + ws + ']'; | ||
var trimBeginRegexp = new RegExp('^' + wsRegexChars + wsRegexChars + '*'); | ||
var trimEndRegexp = new RegExp(wsRegexChars + wsRegexChars + '*$'); | ||
var hasTrimWhitespaceBug = StringPrototype.trim && (ws.trim() || !zeroWidth.trim()); | ||
@@ -1475,6 +1466,6 @@ defineProperties(StringPrototype, { | ||
trim: function trim() { | ||
if (this === void 0 || this === null) { | ||
throw new TypeError("can't convert " + this + " to object"); | ||
if (typeof this === 'undefined' || this === null) { | ||
throw new TypeError("can't convert " + this + ' to object'); | ||
} | ||
return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); | ||
return String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, ''); | ||
} | ||
@@ -1485,2 +1476,3 @@ }, hasTrimWhitespaceBug); | ||
if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) { | ||
/*global parseInt: true */ | ||
parseInt = (function (origParseInt) { | ||
@@ -1487,0 +1479,0 @@ var hexRegex = /^0[xX]/; |
/*! | ||
* https://github.com/es-shims/es5-shim | ||
* @license es5-shim Copyright 2009-2014 by contributors, MIT License | ||
* see https://github.com/es-shims/es5-shim/blob/master/LICENSE | ||
* see https://github.com/es-shims/es5-shim/blob/v4.0.4/LICENSE | ||
*/ | ||
(function(t,e){if(typeof define==="function"&&define.amd){define(e)}else if(typeof exports==="object"){module.exports=e()}else{t.returnExports=e()}})(this,function(){var t=Array.prototype;var e=Object.prototype;var r=Function.prototype;var n=String.prototype;var i=Number.prototype;var a=t.slice;var o=t.splice;var l=t.push;var u=t.unshift;var s=r.call;var f=e.toString;var c=function(t){return e.toString.call(t)==="[object Function]"};var h=function(t){return e.toString.call(t)==="[object RegExp]"};var p=function ve(t){return f.call(t)==="[object Array]"};var v=function ge(t){return f.call(t)==="[object String]"};var g=function ye(t){var e=f.call(t);var r=e==="[object Arguments]";if(!r){r=!p(t)&&t!==null&&typeof t==="object"&&typeof t.length==="number"&&t.length>=0&&c(t.callee)}return r};var y=Object.defineProperty&&function(){try{Object.defineProperty({},"x",{});return true}catch(t){return false}}();var d;if(y){d=function(t,e,r,n){if(!n&&e in t){return}Object.defineProperty(t,e,{configurable:true,enumerable:false,writable:true,value:r})}}else{d=function(t,e,r,n){if(!n&&e in t){return}t[e]=r}}var m=function(t,r,n){for(var i in r){if(e.hasOwnProperty.call(r,i)){d(t,i,r[i],n)}}};function w(t){t=+t;if(t!==t){t=0}else if(t!==0&&t!==1/0&&t!==-(1/0)){t=(t>0||-1)*Math.floor(Math.abs(t))}return t}function b(t){var e=typeof t;return t===null||e==="undefined"||e==="boolean"||e==="number"||e==="string"}function x(t){var e,r,n;if(b(t)){return t}r=t.valueOf;if(c(r)){e=r.call(t);if(b(e)){return e}}n=t.toString;if(c(n)){e=n.call(t);if(b(e)){return e}}throw new TypeError}var S=function(t){if(t==null){throw new TypeError("can't convert "+t+" to object")}return Object(t)};var O=function de(t){return t>>>0};function T(){}m(r,{bind:function me(t){var e=this;if(!c(e)){throw new TypeError("Function.prototype.bind called on incompatible "+e)}var r=a.call(arguments,1);var n=function(){if(this instanceof u){var n=e.apply(this,r.concat(a.call(arguments)));if(Object(n)===n){return n}return this}else{return e.apply(t,r.concat(a.call(arguments)))}};var i=Math.max(0,e.length-r.length);var o=[];for(var l=0;l<i;l++){o.push("$"+l)}var u=Function("binder","return function ("+o.join(",")+"){return binder.apply(this,arguments)}")(n);if(e.prototype){T.prototype=e.prototype;u.prototype=new T;T.prototype=null}return u}});var j=s.bind(e.hasOwnProperty);var E;var N;var I;var D;var _;if(_=j(e,"__defineGetter__")){E=s.bind(e.__defineGetter__);N=s.bind(e.__defineSetter__);I=s.bind(e.__lookupGetter__);D=s.bind(e.__lookupSetter__)}var M=function(){var t=[1,2];var e=t.splice();return t.length===2&&p(e)&&e.length===0}();m(t,{splice:function we(t,e){if(arguments.length===0){return[]}else{return o.apply(this,arguments)}}},M);var F=function(){var e={};t.splice.call(e,0,0,1);return e.length===1}();m(t,{splice:function be(t,e){if(arguments.length===0){return[]}var r=arguments;this.length=Math.max(w(this.length),0);if(arguments.length>0&&typeof e!=="number"){r=a.call(arguments);if(r.length<2){r.push(this.length-t)}else{r[1]=w(e)}}return o.apply(this,r)}},!F);var R=[].unshift(0)!==1;m(t,{unshift:function(){u.apply(this,arguments);return this.length}},R);m(Array,{isArray:p});var k=Object("a");var C=k[0]!=="a"||!(0 in k);var U=function xe(t){var e=true;var r=true;if(t){t.call("foo",function(t,r,n){if(typeof n!=="object"){e=false}});t.call([1],function(){"use strict";r=typeof this==="string"},"x")}return!!t&&e&&r};m(t,{forEach:function Se(t){var e=S(this),r=C&&v(this)?this.split(""):e,n=arguments[1],i=-1,a=r.length>>>0;if(!c(t)){throw new TypeError}while(++i<a){if(i in r){t.call(n,r[i],i,e)}}}},!U(t.forEach));m(t,{map:function Oe(t){var e=S(this),r=C&&v(this)?this.split(""):e,n=r.length>>>0,i=Array(n),a=arguments[1];if(!c(t)){throw new TypeError(t+" is not a function")}for(var o=0;o<n;o++){if(o in r){i[o]=t.call(a,r[o],o,e)}}return i}},!U(t.map));m(t,{filter:function Te(t){var e=S(this),r=C&&v(this)?this.split(""):e,n=r.length>>>0,i=[],a,o=arguments[1];if(!c(t)){throw new TypeError(t+" is not a function")}for(var l=0;l<n;l++){if(l in r){a=r[l];if(t.call(o,a,l,e)){i.push(a)}}}return i}},!U(t.filter));m(t,{every:function je(t){var e=S(this),r=C&&v(this)?this.split(""):e,n=r.length>>>0,i=arguments[1];if(!c(t)){throw new TypeError(t+" is not a function")}for(var a=0;a<n;a++){if(a in r&&!t.call(i,r[a],a,e)){return false}}return true}},!U(t.every));m(t,{some:function Ee(t){var e=S(this),r=C&&v(this)?this.split(""):e,n=r.length>>>0,i=arguments[1];if(!c(t)){throw new TypeError(t+" is not a function")}for(var a=0;a<n;a++){if(a in r&&t.call(i,r[a],a,e)){return true}}return false}},!U(t.some));var A=false;if(t.reduce){A=typeof t.reduce.call("es5",function(t,e,r,n){return n})==="object"}m(t,{reduce:function Ne(t){var e=S(this),r=C&&v(this)?this.split(""):e,n=r.length>>>0;if(!c(t)){throw new TypeError(t+" is not a function")}if(!n&&arguments.length===1){throw new TypeError("reduce of empty array with no initial value")}var i=0;var a;if(arguments.length>=2){a=arguments[1]}else{do{if(i in r){a=r[i++];break}if(++i>=n){throw new TypeError("reduce of empty array with no initial value")}}while(true)}for(;i<n;i++){if(i in r){a=t.call(void 0,a,r[i],i,e)}}return a}},!A);var P=false;if(t.reduceRight){P=typeof t.reduceRight.call("es5",function(t,e,r,n){return n})==="object"}m(t,{reduceRight:function Ie(t){var e=S(this),r=C&&v(this)?this.split(""):e,n=r.length>>>0;if(!c(t)){throw new TypeError(t+" is not a function")}if(!n&&arguments.length===1){throw new TypeError("reduceRight of empty array with no initial value")}var i,a=n-1;if(arguments.length>=2){i=arguments[1]}else{do{if(a in r){i=r[a--];break}if(--a<0){throw new TypeError("reduceRight of empty array with no initial value")}}while(true)}if(a<0){return i}do{if(a in r){i=t.call(void 0,i,r[a],a,e)}}while(a--);return i}},!P);var Z=Array.prototype.indexOf&&[0,1].indexOf(1,2)!==-1;m(t,{indexOf:function De(t){var e=C&&v(this)?this.split(""):S(this),r=e.length>>>0;if(!r){return-1}var n=0;if(arguments.length>1){n=w(arguments[1])}n=n>=0?n:Math.max(0,r+n);for(;n<r;n++){if(n in e&&e[n]===t){return n}}return-1}},Z);var J=Array.prototype.lastIndexOf&&[0,1].lastIndexOf(0,-3)!==-1;m(t,{lastIndexOf:function _e(t){var e=C&&v(this)?this.split(""):S(this),r=e.length>>>0;if(!r){return-1}var n=r-1;if(arguments.length>1){n=Math.min(n,w(arguments[1]))}n=n>=0?n:r-Math.abs(n);for(;n>=0;n--){if(n in e&&t===e[n]){return n}}return-1}},J);var z=!{toString:null}.propertyIsEnumerable("toString"),$=function(){}.propertyIsEnumerable("prototype"),G=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],B=G.length;m(Object,{keys:function Me(t){var e=c(t),r=g(t),n=t!==null&&typeof t==="object",i=n&&v(t);if(!n&&!e&&!r){throw new TypeError("Object.keys called on a non-object")}var a=[];var o=$&&e;if(i||r){for(var l=0;l<t.length;++l){a.push(String(l))}}else{for(var u in t){if(!(o&&u==="prototype")&&j(t,u)){a.push(String(u))}}}if(z){var s=t.constructor,f=s&&s.prototype===t;for(var h=0;h<B;h++){var p=G[h];if(!(f&&p==="constructor")&&j(t,p)){a.push(p)}}}return a}});var H=Object.keys&&function(){return Object.keys(arguments).length===2}(1,2);var L=Object.keys;m(Object,{keys:function Fe(e){if(g(e)){return L(t.slice.call(e))}else{return L(e)}}},!H);var X=-621987552e5;var Y="-000001";var q=Date.prototype.toISOString&&new Date(X).toISOString().indexOf(Y)===-1;m(Date.prototype,{toISOString:function Re(){var t,e,r,n,i;if(!isFinite(this)){throw new RangeError("Date.prototype.toISOString called on non-finite value.")}n=this.getUTCFullYear();i=this.getUTCMonth();n+=Math.floor(i/12);i=(i%12+12)%12;t=[i+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];n=(n<0?"-":n>9999?"+":"")+("00000"+Math.abs(n)).slice(0<=n&&n<=9999?-4:-6);e=t.length;while(e--){r=t[e];if(r<10){t[e]="0"+r}}return n+"-"+t.slice(0,2).join("-")+"T"+t.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}},q);var K=false;try{K=Date.prototype.toJSON&&new Date(NaN).toJSON()===null&&new Date(X).toJSON().indexOf(Y)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(Q){}if(!K){Date.prototype.toJSON=function ke(t){var e=Object(this),r=x(e),n;if(typeof r==="number"&&!isFinite(r)){return null}n=e.toISOString;if(typeof n!=="function"){throw new TypeError("toISOString property is not callable")}return n.call(e)}}var V=Date.parse("+033658-09-27T01:46:40.000Z")===1e15;var W=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z"));var te=isNaN(Date.parse("2000-01-01T00:00:00.000Z"));if(!Date.parse||te||W||!V){Date=function(t){function e(r,n,i,a,o,l,u){var s=arguments.length;if(this instanceof t){var f=s===1&&String(r)===r?new t(e.parse(r)):s>=7?new t(r,n,i,a,o,l,u):s>=6?new t(r,n,i,a,o,l):s>=5?new t(r,n,i,a,o):s>=4?new t(r,n,i,a):s>=3?new t(r,n,i):s>=2?new t(r,n):s>=1?new t(r):new t;f.constructor=e;return f}return t.apply(this,arguments)}var r=new RegExp("^"+"(\\d{4}|[+-]\\d{6})"+"(?:-(\\d{2})"+"(?:-(\\d{2})"+"(?:"+"T(\\d{2})"+":(\\d{2})"+"(?:"+":(\\d{2})"+"(?:(\\.\\d{1,}))?"+")?"+"("+"Z|"+"(?:"+"([-+])"+"(\\d{2})"+":(\\d{2})"+")"+")?)?)?)?"+"$");var n=[0,31,59,90,120,151,181,212,243,273,304,334,365];function i(t,e){var r=e>1?1:0;return n[e]+Math.floor((t-1969+r)/4)-Math.floor((t-1901+r)/100)+Math.floor((t-1601+r)/400)+365*(t-1970)}function a(e){return Number(new t(1970,0,1,0,0,0,e))}for(var o in t){e[o]=t[o]}e.now=t.now;e.UTC=t.UTC;e.prototype=t.prototype;e.prototype.constructor=e;e.parse=function l(e){var n=r.exec(e);if(n){var o=Number(n[1]),l=Number(n[2]||1)-1,u=Number(n[3]||1)-1,s=Number(n[4]||0),f=Number(n[5]||0),c=Number(n[6]||0),h=Math.floor(Number(n[7]||0)*1e3),p=Boolean(n[4]&&!n[8]),v=n[9]==="-"?1:-1,g=Number(n[10]||0),y=Number(n[11]||0),d;if(s<(f>0||c>0||h>0?24:25)&&f<60&&c<60&&h<1e3&&l>-1&&l<12&&g<24&&y<60&&u>-1&&u<i(o,l+1)-i(o,l)){d=((i(o,l)+u)*24+s+g*v)*60;d=((d+f+y*v)*60+c)*1e3+h;if(p){d=a(d)}if(-864e13<=d&&d<=864e13){return d}}return NaN}return t.parse.apply(this,arguments)};return e}(Date)}if(!Date.now){Date.now=function Ce(){return(new Date).getTime()}}var ee=i.toFixed&&(8e-5.toFixed(3)!=="0.000"||.9.toFixed(0)!=="1"||1.255.toFixed(2)!=="1.25"||0xde0b6b3a7640080.toFixed(0)!=="1000000000000000128");var re={base:1e7,size:6,data:[0,0,0,0,0,0],multiply:function Ue(t,e){var r=-1;while(++r<re.size){e+=t*re.data[r];re.data[r]=e%re.base;e=Math.floor(e/re.base)}},divide:function Ae(t){var e=re.size,r=0;while(--e>=0){r+=re.data[e];re.data[e]=Math.floor(r/t);r=r%t*re.base}},numToString:function Pe(){var t=re.size;var e="";while(--t>=0){if(e!==""||t===0||re.data[t]!==0){var r=String(re.data[t]);if(e===""){e=r}else{e+="0000000".slice(0,7-r.length)+r}}}return e},pow:function Ze(t,e,r){return e===0?r:e%2===1?Ze(t,e-1,r*t):Ze(t*t,e/2,r)},log:function Je(t){var e=0;while(t>=4096){e+=12;t/=4096}while(t>=2){e+=1;t/=2}return e}};m(i,{toFixed:function ze(t){var e,r,n,i,a,o,l,u;e=Number(t);e=e!==e?0:Math.floor(e);if(e<0||e>20){throw new RangeError("Number.toFixed called with invalid number of decimals")}r=Number(this);if(r!==r){return"NaN"}if(r<=-1e21||r>=1e21){return String(r)}n="";if(r<0){n="-";r=-r}i="0";if(r>1e-21){a=re.log(r*re.pow(2,69,1))-69;o=a<0?r*re.pow(2,-a,1):r/re.pow(2,a,1);o*=4503599627370496;a=52-a;if(a>0){re.multiply(0,o);l=e;while(l>=7){re.multiply(1e7,0);l-=7}re.multiply(re.pow(10,l,1),0);l=a-1;while(l>=23){re.divide(1<<23);l-=23}re.divide(1<<l);re.multiply(1,1);re.divide(2);i=re.numToString()}else{re.multiply(0,o);re.multiply(1<<-a,0);i=re.numToString()+"0.00000000000000000000".slice(2,2+e)}}if(e>0){u=i.length;if(u<=e){i=n+"0.0000000000000000000".slice(0,e-u+2)+i}else{i=n+i.slice(0,u-e)+"."+i.slice(u-e)}}else{i=n+i}return i}},ee);var ne=n.split;if("ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||"tesst".split(/(s)*/)[1]==="t"||"test".split(/(?:)/,-1).length!==4||"".split(/.?/).length||".".split(/()()/).length>1){(function(){var e=/()??/.exec("")[1]===void 0;n.split=function(r,n){var i=this;if(r===void 0&&n===0){return[]}if(f.call(r)!=="[object RegExp]"){return ne.call(this,r,n)}var a=[],o=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.extended?"x":"")+(r.sticky?"y":""),l=0,u,s,c,h;r=new RegExp(r.source,o+"g");i+="";if(!e){u=new RegExp("^"+r.source+"$(?!\\s)",o)}n=n===void 0?-1>>>0:O(n);while(s=r.exec(i)){c=s.index+s[0].length;if(c>l){a.push(i.slice(l,s.index));if(!e&&s.length>1){s[0].replace(u,function(){for(var t=1;t<arguments.length-2;t++){if(arguments[t]===void 0){s[t]=void 0}}})}if(s.length>1&&s.index<i.length){t.push.apply(a,s.slice(1))}h=s[0].length;l=c;if(a.length>=n){break}}if(r.lastIndex===s.index){r.lastIndex++}}if(l===i.length){if(h||!r.test("")){a.push("")}}else{a.push(i.slice(l))}return a.length>n?a.slice(0,n):a}})()}else if("0".split(void 0,0).length){n.split=function $e(t,e){if(t===void 0&&e===0){return[]}return ne.call(this,t,e)}}var ie=n.replace;var ae=function(){var t=[];"x".replace(/x(.)?/g,function(e,r){t.push(r)});return t.length===1&&typeof t[0]==="undefined"}();if(!ae){n.replace=function Ge(t,e){var r=c(e);var n=h(t)&&/\)[*?]/.test(t.source);if(!r||!n){return ie.call(this,t,e)}else{var i=function(r){var n=arguments.length;var i=t.lastIndex;t.lastIndex=0;var a=t.exec(r);t.lastIndex=i;a.push(arguments[n-2],arguments[n-1]);return e.apply(this,a)};return ie.call(this,t,i)}}}var oe=n.substr;var le="".substr&&"0b".substr(-1)!=="b";m(n,{substr:function Be(t,e){return oe.call(this,t<0?(t=this.length+t)<0?0:t:t,e)}},le);var ue=" \n\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003"+"\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028"+"\u2029\ufeff";var se="\u200b";var fe="["+ue+"]";var ce=new RegExp("^"+fe+fe+"*");var he=new RegExp(fe+fe+"*$");var pe=n.trim&&(ue.trim()||!se.trim());m(n,{trim:function He(){if(this===void 0||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(ce,"").replace(he,"")}},pe);if(parseInt(ue+"08")!==8||parseInt(ue+"0x16")!==22){parseInt=function(t){var e=/^0[xX]/;return function r(n,i){n=String(n).trim();if(!Number(i)){i=e.test(n)?16:10}return t(n,i)}}(parseInt)}}); | ||
(function(t,e){"use strict";if(typeof define==="function"&&define.amd){define(e)}else if(typeof exports==="object"){module.exports=e()}else{t.returnExports=e()}})(this,function(){var t=Array.prototype;var e=Object.prototype;var r=Function.prototype;var n=String.prototype;var i=Number.prototype;var a=t.slice;var o=t.splice;var u=t.push;var l=t.unshift;var s=r.call;var f=e.toString;var c=function(t){return f.call(t)==="[object Function]"};var p=function(t){return f.call(t)==="[object RegExp]"};var h=function le(t){return f.call(t)==="[object Array]"};var v=function se(t){return f.call(t)==="[object String]"};var g=function fe(t){var e=f.call(t);var r=e==="[object Arguments]";if(!r){r=!h(t)&&t!==null&&typeof t==="object"&&typeof t.length==="number"&&t.length>=0&&c(t.callee)}return r};var y=Object.defineProperty&&function(){try{Object.defineProperty({},"x",{});return true}catch(t){return false}}();var d;if(y){d=function(t,e,r,n){if(!n&&e in t){return}Object.defineProperty(t,e,{configurable:true,enumerable:false,writable:true,value:r})}}else{d=function(t,e,r,n){if(!n&&e in t){return}t[e]=r}}var m=function(t,r,n){for(var i in r){if(e.hasOwnProperty.call(r,i)){d(t,i,r[i],n)}}};function b(t){var e=+t;if(e!==e){e=0}else if(e!==0&&e!==1/0&&e!==-(1/0)){e=(e>0||-1)*Math.floor(Math.abs(e))}return e}function w(t){var e=typeof t;return t===null||e==="undefined"||e==="boolean"||e==="number"||e==="string"}function x(t){var e,r,n;if(w(t)){return t}r=t.valueOf;if(c(r)){e=r.call(t);if(w(e)){return e}}n=t.toString;if(c(n)){e=n.call(t);if(w(e)){return e}}throw new TypeError}var O={ToObject:function(t){if(t==null){throw new TypeError("can't convert "+t+" to object")}return Object(t)},ToUint32:function ce(t){return t>>>0}};var T=function pe(){};m(r,{bind:function he(t){var e=this;if(!c(e)){throw new TypeError("Function.prototype.bind called on incompatible "+e)}var r=a.call(arguments,1);var n;var i=function(){if(this instanceof n){var i=e.apply(this,r.concat(a.call(arguments)));if(Object(i)===i){return i}return this}else{return e.apply(t,r.concat(a.call(arguments)))}};var o=Math.max(0,e.length-r.length);var u=[];for(var l=0;l<o;l++){u.push("$"+l)}n=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this, arguments); }")(i);if(e.prototype){T.prototype=e.prototype;n.prototype=new T;T.prototype=null}return n}});var j=s.bind(e.hasOwnProperty);var S=function(){var t=[1,2];var e=t.splice();return t.length===2&&h(e)&&e.length===0}();m(t,{splice:function ve(t,e){if(arguments.length===0){return[]}else{return o.apply(this,arguments)}}},S);var E=function(){var e={};t.splice.call(e,0,0,1);return e.length===1}();m(t,{splice:function ge(t,e){if(arguments.length===0){return[]}var r=arguments;this.length=Math.max(b(this.length),0);if(arguments.length>0&&typeof e!=="number"){r=a.call(arguments);if(r.length<2){r.push(this.length-t)}else{r[1]=b(e)}}return o.apply(this,r)}},!E);var N=[].unshift(0)!==1;m(t,{unshift:function(){l.apply(this,arguments);return this.length}},N);m(Array,{isArray:h});var I=Object("a");var D=I[0]!=="a"||!(0 in I);var M=function ye(t){var e=true;var r=true;if(t){t.call("foo",function(t,r,n){if(typeof n!=="object"){e=false}});t.call([1],function(){"use strict";r=typeof this==="string"},"x")}return!!t&&e&&r};m(t,{forEach:function de(t){var e=O.ToObject(this),r=D&&v(this)?this.split(""):e,n=arguments[1],i=-1,a=r.length>>>0;if(!c(t)){throw new TypeError}while(++i<a){if(i in r){t.call(n,r[i],i,e)}}}},!M(t.forEach));m(t,{map:function me(t){var e=O.ToObject(this),r=D&&v(this)?this.split(""):e,n=r.length>>>0,i=Array(n),a=arguments[1];if(!c(t)){throw new TypeError(t+" is not a function")}for(var o=0;o<n;o++){if(o in r){i[o]=t.call(a,r[o],o,e)}}return i}},!M(t.map));m(t,{filter:function be(t){var e=O.ToObject(this),r=D&&v(this)?this.split(""):e,n=r.length>>>0,i=[],a,o=arguments[1];if(!c(t)){throw new TypeError(t+" is not a function")}for(var u=0;u<n;u++){if(u in r){a=r[u];if(t.call(o,a,u,e)){i.push(a)}}}return i}},!M(t.filter));m(t,{every:function we(t){var e=O.ToObject(this),r=D&&v(this)?this.split(""):e,n=r.length>>>0,i=arguments[1];if(!c(t)){throw new TypeError(t+" is not a function")}for(var a=0;a<n;a++){if(a in r&&!t.call(i,r[a],a,e)){return false}}return true}},!M(t.every));m(t,{some:function xe(t){var e=O.ToObject(this),r=D&&v(this)?this.split(""):e,n=r.length>>>0,i=arguments[1];if(!c(t)){throw new TypeError(t+" is not a function")}for(var a=0;a<n;a++){if(a in r&&t.call(i,r[a],a,e)){return true}}return false}},!M(t.some));var F=false;if(t.reduce){F=typeof t.reduce.call("es5",function(t,e,r,n){return n})==="object"}m(t,{reduce:function Oe(t){var e=O.ToObject(this),r=D&&v(this)?this.split(""):e,n=r.length>>>0;if(!c(t)){throw new TypeError(t+" is not a function")}if(!n&&arguments.length===1){throw new TypeError("reduce of empty array with no initial value")}var i=0;var a;if(arguments.length>=2){a=arguments[1]}else{do{if(i in r){a=r[i++];break}if(++i>=n){throw new TypeError("reduce of empty array with no initial value")}}while(true)}for(;i<n;i++){if(i in r){a=t.call(void 0,a,r[i],i,e)}}return a}},!F);var R=false;if(t.reduceRight){R=typeof t.reduceRight.call("es5",function(t,e,r,n){return n})==="object"}m(t,{reduceRight:function Te(t){var e=O.ToObject(this),r=D&&v(this)?this.split(""):e,n=r.length>>>0;if(!c(t)){throw new TypeError(t+" is not a function")}if(!n&&arguments.length===1){throw new TypeError("reduceRight of empty array with no initial value")}var i,a=n-1;if(arguments.length>=2){i=arguments[1]}else{do{if(a in r){i=r[a--];break}if(--a<0){throw new TypeError("reduceRight of empty array with no initial value")}}while(true)}if(a<0){return i}do{if(a in r){i=t.call(void 0,i,r[a],a,e)}}while(a--);return i}},!R);var U=Array.prototype.indexOf&&[0,1].indexOf(1,2)!==-1;m(t,{indexOf:function je(t){var e=D&&v(this)?this.split(""):O.ToObject(this),r=e.length>>>0;if(!r){return-1}var n=0;if(arguments.length>1){n=b(arguments[1])}n=n>=0?n:Math.max(0,r+n);for(;n<r;n++){if(n in e&&e[n]===t){return n}}return-1}},U);var k=Array.prototype.lastIndexOf&&[0,1].lastIndexOf(0,-3)!==-1;m(t,{lastIndexOf:function Se(t){var e=D&&v(this)?this.split(""):O.ToObject(this),r=e.length>>>0;if(!r){return-1}var n=r-1;if(arguments.length>1){n=Math.min(n,b(arguments[1]))}n=n>=0?n:r-Math.abs(n);for(;n>=0;n--){if(n in e&&t===e[n]){return n}}return-1}},k);var C=!{toString:null}.propertyIsEnumerable("toString"),A=function(){}.propertyIsEnumerable("prototype"),P=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Z=P.length;m(Object,{keys:function Ee(t){var e=c(t),r=g(t),n=t!==null&&typeof t==="object",i=n&&v(t);if(!n&&!e&&!r){throw new TypeError("Object.keys called on a non-object")}var a=[];var o=A&&e;if(i||r){for(var u=0;u<t.length;++u){a.push(String(u))}}else{for(var l in t){if(!(o&&l==="prototype")&&j(t,l)){a.push(String(l))}}}if(C){var s=t.constructor,f=s&&s.prototype===t;for(var p=0;p<Z;p++){var h=P[p];if(!(f&&h==="constructor")&&j(t,h)){a.push(h)}}}return a}});var J=Object.keys&&function(){return Object.keys(arguments).length===2}(1,2);var z=Object.keys;m(Object,{keys:function Ne(e){if(g(e)){return z(t.slice.call(e))}else{return z(e)}}},!J);var $=-621987552e5;var B="-000001";var H=Date.prototype.toISOString&&new Date($).toISOString().indexOf(B)===-1;m(Date.prototype,{toISOString:function Ie(){var t,e,r,n,i;if(!isFinite(this)){throw new RangeError("Date.prototype.toISOString called on non-finite value.")}n=this.getUTCFullYear();i=this.getUTCMonth();n+=Math.floor(i/12);i=(i%12+12)%12;t=[i+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];n=(n<0?"-":n>9999?"+":"")+("00000"+Math.abs(n)).slice(0<=n&&n<=9999?-4:-6);e=t.length;while(e--){r=t[e];if(r<10){t[e]="0"+r}}return n+"-"+t.slice(0,2).join("-")+"T"+t.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}},H);var L=false;try{L=Date.prototype.toJSON&&new Date(NaN).toJSON()===null&&new Date($).toJSON().indexOf(B)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(X){}if(!L){Date.prototype.toJSON=function De(t){var e=Object(this),r=x(e),n;if(typeof r==="number"&&!isFinite(r)){return null}n=e.toISOString;if(typeof n!=="function"){throw new TypeError("toISOString property is not callable")}return n.call(e)}}var Y=Date.parse("+033658-09-27T01:46:40.000Z")===1e15;var q=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z"));var G=isNaN(Date.parse("2000-01-01T00:00:00.000Z"));if(!Date.parse||G||q||!Y){Date=function(t){function e(r,n,i,a,o,u,l){var s=arguments.length;if(this instanceof t){var f=s===1&&String(r)===r?new t(e.parse(r)):s>=7?new t(r,n,i,a,o,u,l):s>=6?new t(r,n,i,a,o,u):s>=5?new t(r,n,i,a,o):s>=4?new t(r,n,i,a):s>=3?new t(r,n,i):s>=2?new t(r,n):s>=1?new t(r):new t;f.constructor=e;return f}return t.apply(this,arguments)}var r=new RegExp("^"+"(\\d{4}|[+-]\\d{6})"+"(?:-(\\d{2})"+"(?:-(\\d{2})"+"(?:"+"T(\\d{2})"+":(\\d{2})"+"(?:"+":(\\d{2})"+"(?:(\\.\\d{1,}))?"+")?"+"("+"Z|"+"(?:"+"([-+])"+"(\\d{2})"+":(\\d{2})"+")"+")?)?)?)?"+"$");var n=[0,31,59,90,120,151,181,212,243,273,304,334,365];function i(t,e){var r=e>1?1:0;return n[e]+Math.floor((t-1969+r)/4)-Math.floor((t-1901+r)/100)+Math.floor((t-1601+r)/400)+365*(t-1970)}function a(e){return Number(new t(1970,0,1,0,0,0,e))}for(var o in t){e[o]=t[o]}e.now=t.now;e.UTC=t.UTC;e.prototype=t.prototype;e.prototype.constructor=e;e.parse=function u(e){var n=r.exec(e);if(n){var o=Number(n[1]),u=Number(n[2]||1)-1,l=Number(n[3]||1)-1,s=Number(n[4]||0),f=Number(n[5]||0),c=Number(n[6]||0),p=Math.floor(Number(n[7]||0)*1e3),h=Boolean(n[4]&&!n[8]),v=n[9]==="-"?1:-1,g=Number(n[10]||0),y=Number(n[11]||0),d;if(s<(f>0||c>0||p>0?24:25)&&f<60&&c<60&&p<1e3&&u>-1&&u<12&&g<24&&y<60&&l>-1&&l<i(o,u+1)-i(o,u)){d=((i(o,u)+l)*24+s+g*v)*60;d=((d+f+y*v)*60+c)*1e3+p;if(h){d=a(d)}if(-864e13<=d&&d<=864e13){return d}}return NaN}return t.parse.apply(this,arguments)};return e}(Date)}if(!Date.now){Date.now=function Me(){return(new Date).getTime()}}var K=i.toFixed&&(8e-5.toFixed(3)!=="0.000"||.9.toFixed(0)!=="1"||1.255.toFixed(2)!=="1.25"||0xde0b6b3a7640080.toFixed(0)!=="1000000000000000128");var Q={base:1e7,size:6,data:[0,0,0,0,0,0],multiply:function Fe(t,e){var r=-1;while(++r<Q.size){e+=t*Q.data[r];Q.data[r]=e%Q.base;e=Math.floor(e/Q.base)}},divide:function Re(t){var e=Q.size,r=0;while(--e>=0){r+=Q.data[e];Q.data[e]=Math.floor(r/t);r=r%t*Q.base}},numToString:function Ue(){var t=Q.size;var e="";while(--t>=0){if(e!==""||t===0||Q.data[t]!==0){var r=String(Q.data[t]);if(e===""){e=r}else{e+="0000000".slice(0,7-r.length)+r}}}return e},pow:function ke(t,e,r){return e===0?r:e%2===1?ke(t,e-1,r*t):ke(t*t,e/2,r)},log:function Ce(t){var e=0;while(t>=4096){e+=12;t/=4096}while(t>=2){e+=1;t/=2}return e}};m(i,{toFixed:function Ae(t){var e,r,n,i,a,o,u,l;e=Number(t);e=e!==e?0:Math.floor(e);if(e<0||e>20){throw new RangeError("Number.toFixed called with invalid number of decimals")}r=Number(this);if(r!==r){return"NaN"}if(r<=-1e21||r>=1e21){return String(r)}n="";if(r<0){n="-";r=-r}i="0";if(r>1e-21){a=Q.log(r*Q.pow(2,69,1))-69;o=a<0?r*Q.pow(2,-a,1):r/Q.pow(2,a,1);o*=4503599627370496;a=52-a;if(a>0){Q.multiply(0,o);u=e;while(u>=7){Q.multiply(1e7,0);u-=7}Q.multiply(Q.pow(10,u,1),0);u=a-1;while(u>=23){Q.divide(1<<23);u-=23}Q.divide(1<<u);Q.multiply(1,1);Q.divide(2);i=Q.numToString()}else{Q.multiply(0,o);Q.multiply(1<<-a,0);i=Q.numToString()+"0.00000000000000000000".slice(2,2+e)}}if(e>0){l=i.length;if(l<=e){i=n+"0.0000000000000000000".slice(0,e-l+2)+i}else{i=n+i.slice(0,l-e)+"."+i.slice(l-e)}}else{i=n+i}return i}},K);var V=n.split;if("ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||"tesst".split(/(s)*/)[1]==="t"||"test".split(/(?:)/,-1).length!==4||"".split(/.?/).length||".".split(/()()/).length>1){(function(){var t=typeof/()??/.exec("")[1]==="undefined";n.split=function(e,r){var n=this;if(typeof e==="undefined"&&r===0){return[]}if(f.call(e)!=="[object RegExp]"){return V.call(this,e,r)}var i=[],a=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),o=0,l,s,c,p;e=new RegExp(e.source,a+"g");n+="";if(!t){l=new RegExp("^"+e.source+"$(?!\\s)",a)}r=typeof r==="undefined"?-1>>>0:O.ToUint32(r);while(s=e.exec(n)){c=s.index+s[0].length;if(c>o){i.push(n.slice(o,s.index));if(!t&&s.length>1){s[0].replace(l,function(){for(var t=1;t<arguments.length-2;t++){if(typeof arguments[t]==="undefined"){s[t]=void 0}}})}if(s.length>1&&s.index<n.length){u.apply(i,s.slice(1))}p=s[0].length;o=c;if(i.length>=r){break}}if(e.lastIndex===s.index){e.lastIndex++}}if(o===n.length){if(p||!e.test("")){i.push("")}}else{i.push(n.slice(o))}return i.length>r?i.slice(0,r):i}})()}else if("0".split(void 0,0).length){n.split=function Pe(t,e){if(typeof t==="undefined"&&e===0){return[]}return V.call(this,t,e)}}var W=n.replace;var _=function(){var t=[];"x".replace(/x(.)?/g,function(e,r){t.push(r)});return t.length===1&&typeof t[0]==="undefined"}();if(!_){n.replace=function Ze(t,e){var r=c(e);var n=p(t)&&/\)[*?]/.test(t.source);if(!r||!n){return W.call(this,t,e)}else{var i=function(r){var n=arguments.length;var i=t.lastIndex;t.lastIndex=0;var a=t.exec(r)||[];t.lastIndex=i;a.push(arguments[n-2],arguments[n-1]);return e.apply(this,a)};return W.call(this,t,i)}}}var te=n.substr;var ee="".substr&&"0b".substr(-1)!=="b";m(n,{substr:function Je(t,e){return te.call(this,t<0?(t=this.length+t)<0?0:t:t,e)}},ee);var re=" \n\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003"+"\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028"+"\u2029\ufeff";var ne="\u200b";var ie="["+re+"]";var ae=new RegExp("^"+ie+ie+"*");var oe=new RegExp(ie+ie+"*$");var ue=n.trim&&(re.trim()||!ne.trim());m(n,{trim:function ze(){if(typeof this==="undefined"||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(ae,"").replace(oe,"")}},ue);if(parseInt(re+"08")!==8||parseInt(re+"0x16")!==22){parseInt=function(t){var e=/^0[xX]/;return function r(n,i){n=String(n).trim();if(!Number(i)){i=e.test(n)?16:10}return t(n,i)}}(parseInt)}}); | ||
//# sourceMappingURL=es5-shim.map |
{ | ||
"name": "es5-shim", | ||
"version": "4.0.1", | ||
"version": "4.0.4", | ||
"description": "ECMAScript 5 compatibility shims for legacy JavaScript engines", | ||
@@ -33,3 +33,3 @@ "homepage": "http://github.com/es-shims/es5-shim/", | ||
"minify-sham": "uglifyjs es5-sham.js --comments --source-map=es5-sham.map -m -b ascii_only=true,beautify=false > es5-sham.min.js", | ||
"test": "jasmine-node --matchall ./ tests/spec/", | ||
"test": "npm run lint && jasmine-node --matchall ./ tests/spec/", | ||
"test-native": "jasmine-node --matchall tests/spec/", | ||
@@ -40,4 +40,4 @@ "lint": "jscs tests/helpers/*.js tests/spec/*.js es5-shim.js es5-sham.js" | ||
"jasmine-node": "~1.14.5", | ||
"jscs": "~1.5.8", | ||
"uglify-js": "~2.4.14" | ||
"jscs": "~1.7.3", | ||
"uglify-js": "~2.4.15" | ||
}, | ||
@@ -63,4 +63,12 @@ "engines": { | ||
] | ||
} | ||
}, | ||
"keywords": [ | ||
"shim", | ||
"es5", | ||
"es5 shim", | ||
"javascript", | ||
"ecmascript", | ||
"polyfill" | ||
] | ||
} | ||
@@ -1,6 +0,8 @@ | ||
#es5-shim <sup>[![Version Badge][2]][1]</sup> | ||
#es5-shim <sup>[![Version Badge][npm-version-svg]][npm-url]</sup> | ||
[![npm badge][9]][1] | ||
[![npm badge][npm-badge-png]][npm-url] | ||
[![Build Status][3]][4] [![dependency status][5]][6] [![dev dependency status][7]][8] | ||
[![Build Status][travis-svg]][travis-url] | ||
[![dependency status][deps-svg]][deps-url] | ||
[![dev dependency status][dev-deps-svg]][dev-deps-url] | ||
@@ -17,2 +19,3 @@ `es5-shim.js` and `es5-shim.min.js` monkey-patch a JavaScript context to | ||
silently fail. Decide carefully whether this is what you want. | ||
**Note:** `es5-sham.js` requires `es5-shim.js` to be able to work properly. | ||
@@ -23,3 +26,4 @@ | ||
The tests are written with the Jasmine BDD test framework. | ||
To run the tests, navigate to <root-folder>/tests/. | ||
To run the tests, navigate to <root-folder>/tests/ , or, | ||
simply `npm install` and `npm test`. | ||
@@ -156,11 +160,11 @@ ## Shims | ||
[1]: https://npmjs.org/package/es5-shim | ||
[2]: http://vb.teelaun.ch/es-shims/es5-shim.svg | ||
[3]: https://travis-ci.org/es-shims/es5-shim.png | ||
[4]: https://travis-ci.org/es-shims/es5-shim | ||
[5]: https://david-dm.org/es-shims/es5-shim.png | ||
[6]: https://david-dm.org/es-shims/es5-shim | ||
[7]: https://david-dm.org/es-shims/es5-shim/dev-status.png | ||
[8]: https://david-dm.org/es-shims/es5-shim#info=devDependencies | ||
[9]: https://nodei.co/npm/es5-shim.png?downloads=true&stars=true | ||
[npm-url]: https://npmjs.org/package/es5-shim | ||
[npm-version-svg]: http://vb.teelaun.ch/es-shims/es5-shim.svg | ||
[travis-svg]: https://travis-ci.org/es-shims/es5-shim.svg | ||
[travis-url]: https://travis-ci.org/es-shims/es5-shim | ||
[deps-svg]: https://david-dm.org/es-shims/es5-shim.svg | ||
[deps-url]: https://david-dm.org/es-shims/es5-shim | ||
[dev-deps-svg]: https://david-dm.org/es-shims/es5-shim/dev-status.svg | ||
[dev-deps-url]: https://david-dm.org/es-shims/es5-shim#info=devDependencies | ||
[npm-badge-png]: https://nodei.co/npm/es5-shim.png?downloads=true&stars=true | ||
var toString = Object.prototype.toString; | ||
var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false. | ||
var hasStrictMode = (function () { | ||
"use strict"; | ||
'use strict'; | ||
return !this; | ||
@@ -308,3 +308,3 @@ }()); | ||
describe('indexOf', function () { | ||
"use strict"; | ||
'use strict'; | ||
var actual, expected, testSubject; | ||
@@ -417,3 +417,3 @@ | ||
describe('lastIndexOf', function () { | ||
"use strict"; | ||
'use strict'; | ||
var actual, expected, testSubject, testAL; | ||
@@ -1160,11 +1160,11 @@ | ||
describe('splice', function () { | ||
var b = ["b"], | ||
a = [1, "a", b], | ||
var b = ['b'], | ||
a = [1, 'a', b], | ||
test; | ||
var makeArray = function (l, prefix) { | ||
prefix = prefix || ""; | ||
prefix = prefix || ''; | ||
var a = []; | ||
while (l--) { | ||
a.unshift(prefix + Array(l + 1).join(" ") + l); | ||
a.unshift(prefix + Array(l + 1).join(' ') + l); | ||
} | ||
@@ -1203,4 +1203,4 @@ return a; | ||
array.splice(0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); | ||
array.splice(1, 0, "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21","F22", "F23", "F24", "F25", "F26"); | ||
array.splice(5, 0, "XXX"); | ||
array.splice(1, 0, 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F20', 'F21', 'F22', 'F23', 'F24', 'F25', 'F26'); | ||
array.splice(5, 0, 'XXX'); | ||
@@ -1213,7 +1213,7 @@ expect(array).toEqual([1, 'F1', 'F2', 'F3', 'F4', 'XXX', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F20', 'F21', 'F22', 'F23', 'F24', 'F25', 'F26', 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]); | ||
array.splice(array.length - 1, 1, ""); | ||
array.splice(array.length - 1, 1, ''); | ||
array.splice(0, 1, 1, 2, 3, 4); | ||
array.splice(0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45); | ||
array.splice(4, 0, "99999999999999"); | ||
array.splice(4, 0, '99999999999999'); | ||
@@ -1228,8 +1228,8 @@ expect(array).toEqual([1, 2, 3, 4, '99999999999999', 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 1, 2, 3, 4, ' 1', ' 2', ' 3', ' 4', '']); | ||
array.splice(0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); | ||
array.splice(1, 1, "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21","F22", "F23", "F24", "F25", "F26"); | ||
array.splice(5, 1, "YYY", "XXX"); | ||
array.splice(1, 1, 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F20', 'F21', 'F22', 'F23', 'F24', 'F25', 'F26'); | ||
array.splice(5, 1, 'YYY', 'XXX'); | ||
array.splice(0, 1); | ||
array.splice(0, 2); | ||
array.pop(); | ||
array.push.apply(array, makeArray(10, "-")); | ||
array.push.apply(array, makeArray(10, '-')); | ||
array.splice(array.length - 2, 10); | ||
@@ -1236,0 +1236,0 @@ array.splice(); |
@@ -13,3 +13,22 @@ describe('Date', function () { | ||
describe("parse", function () { | ||
describe('constructor', function () { | ||
it('works with standard formats', function () { | ||
//Chrome 19 Opera 12 Firefox 11 IE 9 Safari 5.1.1 | ||
expect(+new Date('2012-12-31T23:59:59.000Z')).toBe(1356998399000); //1356998399000 1356998399000 1356998399000 1356998399000 1356998399000 | ||
expect(+new Date('2012-04-04T05:02:02.170Z')).toBe(1333515722170); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(+new Date('2012-04-04T05:02:02.170999Z')).toBe(1333515722170); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(+new Date('2012-04-04T05:02:02.17Z')).toBe(1333515722170); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(+new Date('2012-04-04T05:02:02.1Z')).toBe(1333515722100); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(+new Date('2012-04-04T24:00:00.000Z')).toBe(1333584000000); //NaN 1333584000000 1333584000000 1333584000000 1333584000000 | ||
expect(+new Date('2012-02-29T12:00:00.000Z')).toBe(1330516800000); //1330516800000 1330516800000 1330516800000 1330516800000 1330516800000 | ||
expect(+new Date('2011-03-01T12:00:00.000Z')).toBe(1298980800000); //1298980800000 1298980800000 1298980800000 1298980800000 1298980800000 | ||
// https://github.com/es-shims/es5-shim/issues/80 Safari bug with leap day | ||
expect(new Date('2034-03-01T00:00:00.000Z') - | ||
new Date('2034-02-27T23:59:59.999Z')).toBe(86400001); //86400001 86400001 86400001 86400001 1 | ||
}); | ||
}); | ||
describe('parse', function () { | ||
// TODO: Write the rest of the test. | ||
@@ -27,15 +46,15 @@ | ||
//Chrome 19 Opera 12 Firefox 11 IE 9 Safari 5.1.1 | ||
expect(Date.parse("2012-11-31T23:59:59.000Z")).toBeFalsy(); //1354406399000 NaN NaN 1354406399000 NaN | ||
expect(Date.parse("2012-12-31T23:59:60.000Z")).toBeFalsy(); //NaN NaN NaN NaN 1356998400000 | ||
expect(Date.parse("2012-04-04T24:00:00.500Z")).toBeFalsy(); //NaN NaN 1333584000500 1333584000500 NaN | ||
expect(Date.parse("2012-12-31T10:08:60.000Z")).toBeFalsy(); //NaN NaN NaN NaN 1356948540000 | ||
expect(Date.parse("2012-13-01T12:00:00.000Z")).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse("2012-12-32T12:00:00.000Z")).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse("2012-12-31T25:00:00.000Z")).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse("2012-12-31T24:01:00.000Z")).toBeFalsy(); //NaN NaN NaN 1356998460000 NaN | ||
expect(Date.parse("2012-12-31T12:60:00.000Z")).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse("2012-12-31T12:00:60.000Z")).toBeFalsy(); //NaN NaN NaN NaN 1356955260000 | ||
expect(Date.parse("2012-00-31T23:59:59.000Z")).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse("2012-12-00T23:59:59.000Z")).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse("2011-02-29T12:00:00.000Z")).toBeFalsy(); //1298980800000 NaN NaN 1298980800000 NaN | ||
expect(Date.parse('2012-11-31T23:59:59.000Z')).toBeFalsy(); //1354406399000 NaN NaN 1354406399000 NaN | ||
expect(Date.parse('2012-12-31T23:59:60.000Z')).toBeFalsy(); //NaN NaN NaN NaN 1356998400000 | ||
expect(Date.parse('2012-04-04T24:00:00.500Z')).toBeFalsy(); //NaN NaN 1333584000500 1333584000500 NaN | ||
expect(Date.parse('2012-12-31T10:08:60.000Z')).toBeFalsy(); //NaN NaN NaN NaN 1356948540000 | ||
expect(Date.parse('2012-13-01T12:00:00.000Z')).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse('2012-12-32T12:00:00.000Z')).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse('2012-12-31T25:00:00.000Z')).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse('2012-12-31T24:01:00.000Z')).toBeFalsy(); //NaN NaN NaN 1356998460000 NaN | ||
expect(Date.parse('2012-12-31T12:60:00.000Z')).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse('2012-12-31T12:00:60.000Z')).toBeFalsy(); //NaN NaN NaN NaN 1356955260000 | ||
expect(Date.parse('2012-00-31T23:59:59.000Z')).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse('2012-12-00T23:59:59.000Z')).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse('2011-02-29T12:00:00.000Z')).toBeFalsy(); //1298980800000 NaN NaN 1298980800000 NaN | ||
}); | ||
@@ -45,14 +64,14 @@ | ||
//Chrome 19 Opera 12 Firefox 11 IE 9 Safari 5.1.1 | ||
expect(Date.parse("2012-12-31T23:59:59.000Z")).toBe(1356998399000); //1356998399000 1356998399000 1356998399000 1356998399000 1356998399000 | ||
expect(Date.parse("2012-04-04T05:02:02.170Z")).toBe(1333515722170); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(Date.parse("2012-04-04T05:02:02.170999Z")).toBe(1333515722170); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(Date.parse("2012-04-04T05:02:02.17Z")).toBe(1333515722170); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(Date.parse("2012-04-04T05:02:02.1Z")).toBe(1333515722100); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(Date.parse("2012-04-04T24:00:00.000Z")).toBe(1333584000000); //NaN 1333584000000 1333584000000 1333584000000 1333584000000 | ||
expect(Date.parse("2012-02-29T12:00:00.000Z")).toBe(1330516800000); //1330516800000 1330516800000 1330516800000 1330516800000 1330516800000 | ||
expect(Date.parse("2011-03-01T12:00:00.000Z")).toBe(1298980800000); //1298980800000 1298980800000 1298980800000 1298980800000 1298980800000 | ||
expect(Date.parse('2012-12-31T23:59:59.000Z')).toBe(1356998399000); //1356998399000 1356998399000 1356998399000 1356998399000 1356998399000 | ||
expect(Date.parse('2012-04-04T05:02:02.170Z')).toBe(1333515722170); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(Date.parse('2012-04-04T05:02:02.170999Z')).toBe(1333515722170); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(Date.parse('2012-04-04T05:02:02.17Z')).toBe(1333515722170); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(Date.parse('2012-04-04T05:02:02.1Z')).toBe(1333515722100); //1333515722170 1333515722170 1333515722170 1333515722170 1333515722170 | ||
expect(Date.parse('2012-04-04T24:00:00.000Z')).toBe(1333584000000); //NaN 1333584000000 1333584000000 1333584000000 1333584000000 | ||
expect(Date.parse('2012-02-29T12:00:00.000Z')).toBe(1330516800000); //1330516800000 1330516800000 1330516800000 1330516800000 1330516800000 | ||
expect(Date.parse('2011-03-01T12:00:00.000Z')).toBe(1298980800000); //1298980800000 1298980800000 1298980800000 1298980800000 1298980800000 | ||
// https://github.com/es-shims/es5-shim/issues/80 Safari bug with leap day | ||
expect(Date.parse("2034-03-01T00:00:00.000Z") - | ||
Date.parse("2034-02-27T23:59:59.999Z")).toBe(86400001); //86400001 86400001 86400001 86400001 1 | ||
expect(Date.parse('2034-03-01T00:00:00.000Z') - | ||
Date.parse('2034-02-27T23:59:59.999Z')).toBe(86400001); //86400001 86400001 86400001 86400001 1 | ||
@@ -63,7 +82,7 @@ }); | ||
//Chrome 19 Opera 12 Firefox 11 IE 9 Safari 5.1.1 | ||
expect(Date.parse("0000-01-01T00:00:00.000Z")).toBe(-621672192e5); //-621672192e5 -621672192e5 -621672192e5 -621672192e5 -621672192e5 | ||
expect(Date.parse("+275760-09-13T00:00:00.000Z")).toBe(8.64e15); //8.64e15 NaN 8.64e15 8.64e15 8.64e15 | ||
expect(Date.parse("-271821-04-20T00:00:00.000Z")).toBe(-8.64e15); //-8.64e15 NaN -8.64e15 -8.64e15 -8.6400000864e15 | ||
expect(Date.parse("+275760-09-13T00:00:00.001Z")).toBeFalsy(); //NaN NaN NaN 8.64e15 + 1 8.64e15 + 1 | ||
expect(Date.parse("-271821-04-19T23:59:59.999Z")).toBeFalsy(); //NaN NaN NaN -8.64e15 - 1 -8.6400000864e15 - 1 | ||
expect(Date.parse('0000-01-01T00:00:00.000Z')).toBe(-621672192e5); //-621672192e5 -621672192e5 -621672192e5 -621672192e5 -621672192e5 | ||
expect(Date.parse('+275760-09-13T00:00:00.000Z')).toBe(8.64e15); //8.64e15 NaN 8.64e15 8.64e15 8.64e15 | ||
expect(Date.parse('-271821-04-20T00:00:00.000Z')).toBe(-8.64e15); //-8.64e15 NaN -8.64e15 -8.64e15 -8.6400000864e15 | ||
expect(Date.parse('+275760-09-13T00:00:00.001Z')).toBeFalsy(); //NaN NaN NaN 8.64e15 + 1 8.64e15 + 1 | ||
expect(Date.parse('-271821-04-19T23:59:59.999Z')).toBeFalsy(); //NaN NaN NaN -8.64e15 - 1 -8.6400000864e15 - 1 | ||
}); | ||
@@ -73,14 +92,14 @@ | ||
//Chrome 19 Opera 12 Firefox 11 IE 9 Safari 5.1.1 | ||
expect(Date.parse("2012-01-29T12:00:00.000+01:00")).toBe(132783480e4);//132783480e4 132783480e4 132783480e4 132783480e4 132783480e4 | ||
expect(Date.parse("2012-01-29T12:00:00.000-00:00")).toBe(132783840e4);//132783840e4 132783840e4 132783840e4 132783840e4 132783840e4 | ||
expect(Date.parse("2012-01-29T12:00:00.000+00:00")).toBe(132783840e4);//132783840e4 132783840e4 132783840e4 132783840e4 132783840e4 | ||
expect(Date.parse("2012-01-29T12:00:00.000+23:59")).toBe(132775206e4);//132775206e4 132775206e4 132775206e4 132775206e4 132775206e4 | ||
expect(Date.parse("2012-01-29T12:00:00.000-23:59")).toBe(132792474e4);//132792474e4 132792474e4 132792474e4 132792474e4 132792474e4 | ||
expect(Date.parse("2012-01-29T12:00:00.000+24:00")).toBeFalsy(); //NaN 1327752e6 NaN 1327752000000 1327752000000 | ||
expect(Date.parse("2012-01-29T12:00:00.000+24:01")).toBeFalsy(); //NaN NaN NaN 1327751940000 1327751940000 | ||
expect(Date.parse("2012-01-29T12:00:00.000+24:59")).toBeFalsy(); //NaN NaN NaN 1327748460000 1327748460000 | ||
expect(Date.parse("2012-01-29T12:00:00.000+25:00")).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse("2012-01-29T12:00:00.000+00:60")).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse("-271821-04-20T00:00:00.000+00:01")).toBeFalsy(); //NaN NaN NaN -864000000006e4 -864000008646e4 | ||
expect(Date.parse("-271821-04-20T00:01:00.000+00:01")).toBe(-8.64e15);//-8.64e15 NaN -8.64e15 -8.64e15 -864000008640e4 | ||
expect(Date.parse('2012-01-29T12:00:00.000+01:00')).toBe(132783480e4);//132783480e4 132783480e4 132783480e4 132783480e4 132783480e4 | ||
expect(Date.parse('2012-01-29T12:00:00.000-00:00')).toBe(132783840e4);//132783840e4 132783840e4 132783840e4 132783840e4 132783840e4 | ||
expect(Date.parse('2012-01-29T12:00:00.000+00:00')).toBe(132783840e4);//132783840e4 132783840e4 132783840e4 132783840e4 132783840e4 | ||
expect(Date.parse('2012-01-29T12:00:00.000+23:59')).toBe(132775206e4);//132775206e4 132775206e4 132775206e4 132775206e4 132775206e4 | ||
expect(Date.parse('2012-01-29T12:00:00.000-23:59')).toBe(132792474e4);//132792474e4 132792474e4 132792474e4 132792474e4 132792474e4 | ||
expect(Date.parse('2012-01-29T12:00:00.000+24:00')).toBeFalsy(); //NaN 1327752e6 NaN 1327752000000 1327752000000 | ||
expect(Date.parse('2012-01-29T12:00:00.000+24:01')).toBeFalsy(); //NaN NaN NaN 1327751940000 1327751940000 | ||
expect(Date.parse('2012-01-29T12:00:00.000+24:59')).toBeFalsy(); //NaN NaN NaN 1327748460000 1327748460000 | ||
expect(Date.parse('2012-01-29T12:00:00.000+25:00')).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse('2012-01-29T12:00:00.000+00:60')).toBeFalsy(); //NaN NaN NaN NaN NaN | ||
expect(Date.parse('-271821-04-20T00:00:00.000+00:01')).toBeFalsy(); //NaN NaN NaN -864000000006e4 -864000008646e4 | ||
expect(Date.parse('-271821-04-20T00:01:00.000+00:01')).toBe(-8.64e15);//-8.64e15 NaN -8.64e15 -8.64e15 -864000008640e4 | ||
@@ -94,3 +113,3 @@ // When time zone is missed, local offset should be used (ES 5.1 bug) | ||
it("should be able to coerce to a number", function () { | ||
it('should be able to coerce to a number', function () { | ||
var actual = Number(new Date(1970, 0)); | ||
@@ -105,3 +124,3 @@ var expected = parseInt(actual, 10); | ||
describe("toString", function () { | ||
describe('toString', function () { | ||
var actual; | ||
@@ -113,3 +132,3 @@ | ||
it("should show correct date info for " + actual, function () { | ||
it('should show correct date info for ' + actual, function () { | ||
expect(actual).toMatch(/1970/); | ||
@@ -122,3 +141,3 @@ expect(actual).toMatch(/jan/i); | ||
describe("valueOf", function () { | ||
describe('valueOf', function () { | ||
// Note that new Date(1970, 0).valueOf() is 0 in UTC timezone. | ||
@@ -131,9 +150,9 @@ // Check check that it's a number (and an int), not that it's "truthy". | ||
}); | ||
it("should give a numeric value", function () { | ||
expect(typeof actual).toBe("number"); | ||
it('should give a numeric value', function () { | ||
expect(typeof actual).toBe('number'); | ||
}); | ||
it("should not be NaN", function () { | ||
it('should not be NaN', function () { | ||
expect(isNaN(actual)).toBe(false); | ||
}); | ||
it("should give an int value", function () { | ||
it('should give an int value', function () { | ||
expect(actual).toBe(Math.floor(actual)); | ||
@@ -143,3 +162,3 @@ }); | ||
describe("toISOString", function () { | ||
describe('toISOString', function () { | ||
// TODO: write the rest of the test. | ||
@@ -159,3 +178,3 @@ | ||
describe("toJSON", function () { | ||
describe('toJSON', function () { | ||
@@ -162,0 +181,0 @@ // Opera 11.6x/12 bug |
describe('Function', function () { | ||
"use strict"; | ||
'use strict'; | ||
@@ -109,6 +109,6 @@ describe('apply', function () { | ||
it('passes the correct arguments as a constructor', function () { | ||
var ret, expected = { name: "Correct" }; | ||
var ret, expected = { name: 'Correct' }; | ||
testSubject.func = function (arg) { | ||
return arg; | ||
}.bind({ name: "Incorrect" }); | ||
}.bind({ name: 'Incorrect' }); | ||
ret = new testSubject.func(expected); | ||
@@ -141,3 +141,3 @@ expect(ret).toBe(expected); | ||
oracle = "asdf"; | ||
oracle = 'asdf'; | ||
result = new Subject(); | ||
@@ -160,5 +160,5 @@ expect(result).not.toBe(oracle); | ||
var ClassA = function (x) { | ||
this.name = x || "A"; | ||
this.name = x || 'A'; | ||
}; | ||
var ClassB = ClassA.bind(null, "B"); | ||
var ClassB = ClassA.bind(null, 'B'); | ||
@@ -165,0 +165,0 @@ var result = new ClassB(); |
@@ -32,5 +32,5 @@ describe('global methods', function () { | ||
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" + | ||
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + | ||
"\u2029\uFEFF"; | ||
var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + | ||
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + | ||
'\u2029\uFEFF'; | ||
expect(parseInt(ws + '08')).toBe(parseInt('08', 10)); | ||
@@ -37,0 +37,0 @@ expect(parseInt(ws + '0x16')).toBe(parseInt('0x16', 16)); |
describe('Object', function () { | ||
"use strict"; | ||
'use strict'; | ||
describe("Object.keys", function () { | ||
describe('Object.keys', function () { | ||
var obj = { | ||
str: "boz", | ||
str: 'boz', | ||
obj: { }, | ||
@@ -11,3 +11,3 @@ arr: [], | ||
num: 42, | ||
"null": null, | ||
'null': null, | ||
undefined: undefined | ||
@@ -106,3 +106,3 @@ }; | ||
describe("Object.isExtensible", function () { | ||
describe('Object.isExtensible', function () { | ||
var obj = { }; | ||
@@ -138,3 +138,3 @@ | ||
describe("Object.defineProperty", function () { | ||
describe('Object.defineProperty', function () { | ||
var obj; | ||
@@ -188,3 +188,3 @@ | ||
describe("Object.getOwnPropertyDescriptor", function () { | ||
describe('Object.getOwnPropertyDescriptor', function () { | ||
it('should return undefined because the object does not own the property', function () { | ||
@@ -191,0 +191,0 @@ var descr = Object.getOwnPropertyDescriptor({}, 'name'); |
describe('String', function () { | ||
"use strict"; | ||
describe("trim", function () { | ||
var test = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFFHello, World!\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF"; | ||
'use strict'; | ||
describe('trim', function () { | ||
var test = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFFHello, World!\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; | ||
it('trims all ES5 whitespace', function () { | ||
expect(test.trim()).toEqual("Hello, World!"); | ||
expect(test.trim()).toEqual('Hello, World!'); | ||
expect(test.trim().length).toBe(13); | ||
@@ -17,3 +17,3 @@ }); | ||
describe("replace", function () { | ||
describe('replace', function () { | ||
it('returns undefined for non-capturing groups', function () { | ||
@@ -27,6 +27,15 @@ var groups = []; | ||
}); | ||
it('should not fail in Firefox', function () { | ||
expect(function () { | ||
return '* alef\n* beth \n* gimel~0\n'.replace( | ||
/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm, | ||
function (match, m1, m2, m3, m4) { return '<li>' + m4 + '</li>\n'; } | ||
); | ||
}).not.toThrow(); | ||
}); | ||
}); | ||
describe("split", function () { | ||
var test = "ab"; | ||
describe('split', function () { | ||
var test = 'ab'; | ||
@@ -33,0 +42,0 @@ it('If "separator" is undefined must return Array with one String - "this" string', function () { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
334571
36
6848
168