Comparing version 3.3.0 to 3.3.1
{ | ||
"name": "es5-shim", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"main": "es5-shim.js", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -5,3 +5,3 @@ { | ||
"description": "ECMAScript 5 compatibility shims for legacy JavaScript engines", | ||
"version": "v3.3.0", | ||
"version": "v3.3.1", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "shim", |
@@ -257,2 +257,3 @@ /*! | ||
} else { | ||
this.length = Math.max(toInteger(this.length), 0); | ||
return array_splice.apply(this, [ | ||
@@ -513,3 +514,3 @@ start === void 0 ? 0 : start, | ||
if (Array.prototype.reduce) { | ||
reduceCoercesToObject = typeof Array.prototype.reduce.call('a', function (_, __, ___, list) { return list; }) === 'object'; | ||
reduceCoercesToObject = typeof Array.prototype.reduce.call('es5', function (_, __, ___, list) { return list; }) === 'object'; | ||
} | ||
@@ -567,3 +568,3 @@ if (!Array.prototype.reduce || !reduceCoercesToObject) { | ||
if (Array.prototype.reduceRight) { | ||
reduceRightCoercesToObject = typeof Array.prototype.reduceRight.call('a', function (_, __, ___, list) { return list; }) === 'object'; | ||
reduceRightCoercesToObject = typeof Array.prototype.reduceRight.call('es5', function (_, __, ___, list) { return list; }) === 'object'; | ||
} | ||
@@ -570,0 +571,0 @@ if (!Array.prototype.reduceRight || !reduceRightCoercesToObject) { |
@@ -6,3 +6,3 @@ /*! | ||
*/ | ||
(function(t,r){if(typeof define==="function"&&define.amd){define(r)}else if(typeof exports==="object"){module.exports=r()}else{t.returnExports=r()}})(this,function(){var t=Function.prototype.call;var r=Array.prototype;var e=Object.prototype;var n=r.slice;var i=Array.prototype.splice;var o=Array.prototype.push;var a=Array.prototype.unshift;var l=function(t){return e.toString.call(t)==="[object Function]"};var u=function(t){return e.toString.call(t)==="[object RegExp]"};function p(){}if(!Function.prototype.bind){Function.prototype.bind=function L(t){var r=this;if(!l(r)){throw new TypeError("Function.prototype.bind called on incompatible "+r)}var e=n.call(arguments,1);var i=function(){if(this instanceof s){var i=r.apply(this,e.concat(n.call(arguments)));if(Object(i)===i){return i}return this}else{return r.apply(t,e.concat(n.call(arguments)))}};var o=Math.max(0,r.length-e.length);var a=[];for(var u=0;u<o;u++){a.push("$"+u)}var s=Function("binder","return function("+a.join(",")+"){return binder.apply(this,arguments)}")(i);if(r.prototype){p.prototype=r.prototype;s.prototype=new p;p.prototype=null}return s}}var s=t.bind(e.hasOwnProperty);var f=t.bind(e.toString);var c;var h;var y;var g;var v;if(v=s(e,"__defineGetter__")){c=t.bind(e.__defineGetter__);h=t.bind(e.__defineSetter__);y=t.bind(e.__lookupGetter__);g=t.bind(e.__lookupSetter__)}if([1,2].splice(0).length!==2){if(function(){function t(t){var r=[];while(t--){r.unshift(t)}return r}var r=[];var e;r.splice.bind(r,0,0).apply(null,t(20));r.splice.bind(r,0,0).apply(null,t(26));e=r.length;r.splice(5,0,"XXX");if(e+1===r.length){return true}}()){Array.prototype.splice=function(t,r){if(!arguments.length){return[]}else{return i.apply(this,[t===void 0?0:t,r===void 0?this.length-t:r].concat(n.call(arguments,2)))}}}else{Array.prototype.splice=function(t,r){var e;var l=n.call(arguments,2);var u=l.length;if(!arguments.length){return[]}if(t===void 0){t=0}if(r===void 0){r=this.length-t}if(u>0){if(r<=0){if(t===this.length){o.apply(this,l);return[]}if(t===0){a.apply(this,l);return[]}}e=n.call(this,t,t+r);l.push.apply(l,n.call(this,t+r,this.length));l.unshift.apply(l,n.call(this,0,t));l.unshift(0,this.length);i.apply(this,l);return e}return i.call(this,t,r)}}}if([].unshift(0)!==1){Array.prototype.unshift=function(){a.apply(this,arguments);return this.length}}if(!Array.isArray){Array.isArray=function Y(t){return f(t)==="[object Array]"}}var d=Object("a");var b=d[0]!=="a"||!(0 in d);var m=function q(t){var r=true;var e=true;if(t){t.call("foo",function(t,e,n){if(typeof n!=="object"){r=false}});t.call([1],function(){"use strict";e=typeof this==="string"},"x")}return!!t&&r&&e};if(!Array.prototype.forEach||!m(Array.prototype.forEach)){Array.prototype.forEach=function z(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=arguments[1],i=-1,o=e.length>>>0;if(!l(t)){throw new TypeError}while(++i<o){if(i in e){t.call(n,e[i],i,r)}}}}if(!Array.prototype.map||!m(Array.prototype.map)){Array.prototype.map=function K(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0,i=Array(n),o=arguments[1];if(!l(t)){throw new TypeError(t+" is not a function")}for(var a=0;a<n;a++){if(a in e)i[a]=t.call(o,e[a],a,r)}return i}}if(!Array.prototype.filter||!m(Array.prototype.filter)){Array.prototype.filter=function Q(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0,i=[],o,a=arguments[1];if(!l(t)){throw new TypeError(t+" is not a function")}for(var u=0;u<n;u++){if(u in e){o=e[u];if(t.call(a,o,u,r)){i.push(o)}}}return i}}if(!Array.prototype.every||!m(Array.prototype.every)){Array.prototype.every=function V(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0,i=arguments[1];if(!l(t)){throw new TypeError(t+" is not a function")}for(var o=0;o<n;o++){if(o in e&&!t.call(i,e[o],o,r)){return false}}return true}}if(!Array.prototype.some||!m(Array.prototype.some)){Array.prototype.some=function W(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0,i=arguments[1];if(!l(t)){throw new TypeError(t+" is not a function")}for(var o=0;o<n;o++){if(o in e&&t.call(i,e[o],o,r)){return true}}return false}}var w=false;if(Array.prototype.reduce){w=typeof Array.prototype.reduce.call("a",function(t,r,e,n){return n})==="object"}if(!Array.prototype.reduce||!w){Array.prototype.reduce=function tr(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0;if(!l(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 o;if(arguments.length>=2){o=arguments[1]}else{do{if(i in e){o=e[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 e){o=t.call(void 0,o,e[i],i,r)}}return o}}var S=false;if(Array.prototype.reduceRight){S=typeof Array.prototype.reduceRight.call("a",function(t,r,e,n){return n})==="object"}if(!Array.prototype.reduceRight||!S){Array.prototype.reduceRight=function rr(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0;if(!l(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,o=n-1;if(arguments.length>=2){i=arguments[1]}else{do{if(o in e){i=e[o--];break}if(--o<0){throw new TypeError("reduceRight of empty array with no initial value")}}while(true)}if(o<0){return i}do{if(o in this){i=t.call(void 0,i,e[o],o,r)}}while(o--);return i}}if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!==-1){Array.prototype.indexOf=function er(t){var r=b&&f(this)==="[object String]"?this.split(""):H(this),e=r.length>>>0;if(!e){return-1}var n=0;if(arguments.length>1){n=G(arguments[1])}n=n>=0?n:Math.max(0,e+n);for(;n<e;n++){if(n in r&&r[n]===t){return n}}return-1}}if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!==-1){Array.prototype.lastIndexOf=function nr(t){var r=b&&f(this)==="[object String]"?this.split(""):H(this),e=r.length>>>0;if(!e){return-1}var n=e-1;if(arguments.length>1){n=Math.min(n,G(arguments[1]))}n=n>=0?n:e-Math.abs(n);for(;n>=0;n--){if(n in r&&t===r[n]){return n}}return-1}}if(!Object.keys){var x=!{toString:null}.propertyIsEnumerable("toString"),A=function(){}.propertyIsEnumerable("prototype"),j=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],E=j.length,N=function ir(t){var r=f(t);var e=r==="[object Arguments]";if(!e){e=!Array.isArray(r)&&t!==null&&typeof t==="object"&&typeof t.length==="number"&&t.length>=0&&l(t.callee)}return e};Object.keys=function or(t){var r=l(t),e=N(t),n=t!==null&&typeof t==="object",i=n&&f(t)==="[object String]";if(!n&&!r&&!e){throw new TypeError("Object.keys called on a non-object")}var o=[];var a=A&&r;if(i||e){for(var u=0;u<t.length;++u){o.push(String(u))}}else{for(var p in t){if(!(a&&p==="prototype")&&s(t,p)){o.push(String(p))}}}if(x){var c=t.constructor,h=c&&c.prototype===t;for(var y=0;y<E;y++){var g=j[y];if(!(h&&g==="constructor")&&s(t,g)){o.push(g)}}}return o}}var O=-621987552e5,T="-000001";if(!Date.prototype.toISOString||new Date(O).toISOString().indexOf(T)===-1){Date.prototype.toISOString=function ar(){var t,r,e,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);r=t.length;while(r--){e=t[r];if(e<10){t[r]="0"+e}}return n+"-"+t.slice(0,2).join("-")+"T"+t.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}}var I=false;try{I=Date.prototype.toJSON&&new Date(NaN).toJSON()===null&&new Date(O).toJSON().indexOf(T)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(D){}if(!I){Date.prototype.toJSON=function lr(t){var r=Object(this),e=B(r),n;if(typeof e==="number"&&!isFinite(e)){return null}n=r.toISOString;if(typeof n!=="function"){throw new TypeError("toISOString property is not callable")}return n.call(r)}}var _=Date.parse("+033658-09-27T01:46:40.000Z")===1e15;var M=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z"));var F=isNaN(Date.parse("2000-01-01T00:00:00.000Z"));if(!Date.parse||F||M||!_){Date=function(t){function r(e,n,i,o,a,l,u){var p=arguments.length;if(this instanceof t){var s=p===1&&String(e)===e?new t(r.parse(e)):p>=7?new t(e,n,i,o,a,l,u):p>=6?new t(e,n,i,o,a,l):p>=5?new t(e,n,i,o,a):p>=4?new t(e,n,i,o):p>=3?new t(e,n,i):p>=2?new t(e,n):p>=1?new t(e):new t;s.constructor=r;return s}return t.apply(this,arguments)}var e=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,r){var e=r>1?1:0;return n[r]+Math.floor((t-1969+e)/4)-Math.floor((t-1901+e)/100)+Math.floor((t-1601+e)/400)+365*(t-1970)}function o(r){return Number(new t(1970,0,1,0,0,0,r))}for(var a in t){r[a]=t[a]}r.now=t.now;r.UTC=t.UTC;r.prototype=t.prototype;r.prototype.constructor=r;r.parse=function l(r){var n=e.exec(r);if(n){var a=Number(n[1]),l=Number(n[2]||1)-1,u=Number(n[3]||1)-1,p=Number(n[4]||0),s=Number(n[5]||0),f=Number(n[6]||0),c=Math.floor(Number(n[7]||0)*1e3),h=Boolean(n[4]&&!n[8]),y=n[9]==="-"?1:-1,g=Number(n[10]||0),v=Number(n[11]||0),d;if(p<(s>0||f>0||c>0?24:25)&&s<60&&f<60&&c<1e3&&l>-1&&l<12&&g<24&&v<60&&u>-1&&u<i(a,l+1)-i(a,l)){d=((i(a,l)+u)*24+p+g*y)*60;d=((d+s+v*y)*60+f)*1e3+c;if(h){d=o(d)}if(-864e13<=d&&d<=864e13){return d}}return NaN}return t.parse.apply(this,arguments)};return r}(Date)}if(!Date.now){Date.now=function ur(){return(new Date).getTime()}}if(!Number.prototype.toFixed||8e-5.toFixed(3)!=="0.000"||.9.toFixed(0)==="0"||1.255.toFixed(2)!=="1.25"||0xde0b6b3a7640080.toFixed(0)!=="1000000000000000128"){(function(){var t,r,e,n;t=1e7;r=6;e=[0,0,0,0,0,0];function i(n,i){var o=-1;while(++o<r){i+=n*e[o];e[o]=i%t;i=Math.floor(i/t)}}function o(n){var i=r,o=0;while(--i>=0){o+=e[i];e[i]=Math.floor(o/n);o=o%n*t}}function a(){var t=r;var n="";while(--t>=0){if(n!==""||t===0||e[t]!==0){var i=String(e[t]);if(n===""){n=i}else{n+="0000000".slice(0,7-i.length)+i}}}return n}function l(t,r,e){return r===0?e:r%2===1?l(t,r-1,e*t):l(t*t,r/2,e)}function u(t){var r=0;while(t>=4096){r+=12;t/=4096}while(t>=2){r+=1;t/=2}return r}Number.prototype.toFixed=function p(t){var r,e,n,p,s,f,c,h;r=Number(t);r=r!==r?0:Math.floor(r);if(r<0||r>20){throw new RangeError("Number.toFixed called with invalid number of decimals")}e=Number(this);if(e!==e){return"NaN"}if(e<=-1e21||e>=1e21){return String(e)}n="";if(e<0){n="-";e=-e}p="0";if(e>1e-21){s=u(e*l(2,69,1))-69;f=s<0?e*l(2,-s,1):e/l(2,s,1);f*=4503599627370496;s=52-s;if(s>0){i(0,f);c=r;while(c>=7){i(1e7,0);c-=7}i(l(10,c,1),0);c=s-1;while(c>=23){o(1<<23);c-=23}o(1<<c);i(1,1);o(2);p=a()}else{i(0,f);i(1<<-s,0);p=a()+"0.00000000000000000000".slice(2,2+r)}}if(r>0){h=p.length;if(h<=r){p=n+"0.0000000000000000000".slice(0,r-h+2)+p}else{p=n+p.slice(0,h-r)+"."+p.slice(h-r)}}else{p=n+p}return p}})()}var R=String.prototype.split;if("ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||"tesst".split(/(s)*/)[1]==="t"||"".split(/.?/).length||".".split(/()()/).length>1){(function(){var t=/()??/.exec("")[1]===void 0;String.prototype.split=function(r,e){var n=this;if(r===void 0&&e===0)return[];if(f(r)!=="[object RegExp]"){return R.apply(this,arguments)}var i=[],o=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.extended?"x":"")+(r.sticky?"y":""),a=0,l,u,p,s;r=new RegExp(r.source,o+"g");n+="";if(!t){l=new RegExp("^"+r.source+"$(?!\\s)",o)}e=e===void 0?-1>>>0:e>>>0;while(u=r.exec(n)){p=u.index+u[0].length;if(p>a){i.push(n.slice(a,u.index));if(!t&&u.length>1){u[0].replace(l,function(){for(var t=1;t<arguments.length-2;t++){if(arguments[t]===void 0){u[t]=void 0}}})}if(u.length>1&&u.index<n.length){Array.prototype.push.apply(i,u.slice(1))}s=u[0].length;a=p;if(i.length>=e){break}}if(r.lastIndex===u.index){r.lastIndex++}}if(a===n.length){if(s||!r.test("")){i.push("")}}else{i.push(n.slice(a))}return i.length>e?i.slice(0,e):i}})()}else if("0".split(void 0,0).length){String.prototype.split=function pr(t,r){if(t===void 0&&r===0)return[];return R.apply(this,arguments)}}var C=String.prototype.replace;var k=function(){var t=[];"x".replace(/x(.)?/g,function(r,e){t.push(e)});return t.length===1&&typeof t[0]==="undefined"}();if(!k){String.prototype.replace=function sr(t,r){var e=l(r);var n=u(t)&&/\)[*?]/.test(t.source);if(!e||!n){return C.apply(this,arguments)}else{var i=function(e){var n=arguments.length;var i=t.lastIndex;t.lastIndex=0;var o=t.exec(e);t.lastIndex=i;o.push(arguments[n-2],arguments[n-1]);return r.apply(this,o)};return C.call(this,t,i)}}}if("".substr&&"0b".substr(-1)!=="b"){var U=String.prototype.substr;String.prototype.substr=function fr(t,r){return U.call(this,t<0?(t=this.length+t)<0?0:t:t,r)}}var Z=" \n\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003"+"\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028"+"\u2029\ufeff";var J="\u200b";if(!String.prototype.trim||Z.trim()||!J.trim()){Z="["+Z+"]";var X=new RegExp("^"+Z+Z+"*"),$=new RegExp(Z+Z+"*$");String.prototype.trim=function cr(){if(this===void 0||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(X,"").replace($,"")}}if(parseInt(Z+"08")!==8||parseInt(Z+"0x16")!==22){parseInt=function(t){var r=/^0[xX]/;return function e(n,i){n=String(n).trim();if(!Number(i)){i=r.test(n)?16:10}return t(n,i)}}(parseInt)}function G(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 P(t){var r=typeof t;return t===null||r==="undefined"||r==="boolean"||r==="number"||r==="string"}function B(t){var r,e,n;if(P(t)){return t}e=t.valueOf;if(l(e)){r=e.call(t);if(P(r)){return r}}n=t.toString;if(l(n)){r=n.call(t);if(P(r)){return r}}throw new TypeError}var H=function(t){if(t==null){throw new TypeError("can't convert "+t+" to object")}return Object(t)}}); | ||
(function(t,r){if(typeof define==="function"&&define.amd){define(r)}else if(typeof exports==="object"){module.exports=r()}else{t.returnExports=r()}})(this,function(){var t=Function.prototype.call;var r=Array.prototype;var e=Object.prototype;var n=r.slice;var i=Array.prototype.splice;var o=Array.prototype.push;var a=Array.prototype.unshift;var l=function(t){return e.toString.call(t)==="[object Function]"};var u=function(t){return e.toString.call(t)==="[object RegExp]"};function p(){}if(!Function.prototype.bind){Function.prototype.bind=function L(t){var r=this;if(!l(r)){throw new TypeError("Function.prototype.bind called on incompatible "+r)}var e=n.call(arguments,1);var i=function(){if(this instanceof s){var i=r.apply(this,e.concat(n.call(arguments)));if(Object(i)===i){return i}return this}else{return r.apply(t,e.concat(n.call(arguments)))}};var o=Math.max(0,r.length-e.length);var a=[];for(var u=0;u<o;u++){a.push("$"+u)}var s=Function("binder","return function("+a.join(",")+"){return binder.apply(this,arguments)}")(i);if(r.prototype){p.prototype=r.prototype;s.prototype=new p;p.prototype=null}return s}}var s=t.bind(e.hasOwnProperty);var f=t.bind(e.toString);var c;var h;var y;var g;var v;if(v=s(e,"__defineGetter__")){c=t.bind(e.__defineGetter__);h=t.bind(e.__defineSetter__);y=t.bind(e.__lookupGetter__);g=t.bind(e.__lookupSetter__)}if([1,2].splice(0).length!==2){if(function(){function t(t){var r=[];while(t--){r.unshift(t)}return r}var r=[];var e;r.splice.bind(r,0,0).apply(null,t(20));r.splice.bind(r,0,0).apply(null,t(26));e=r.length;r.splice(5,0,"XXX");if(e+1===r.length){return true}}()){Array.prototype.splice=function(t,r){if(!arguments.length){return[]}else{this.length=Math.max(G(this.length),0);return i.apply(this,[t===void 0?0:t,r===void 0?this.length-t:r].concat(n.call(arguments,2)))}}}else{Array.prototype.splice=function(t,r){var e;var l=n.call(arguments,2);var u=l.length;if(!arguments.length){return[]}if(t===void 0){t=0}if(r===void 0){r=this.length-t}if(u>0){if(r<=0){if(t===this.length){o.apply(this,l);return[]}if(t===0){a.apply(this,l);return[]}}e=n.call(this,t,t+r);l.push.apply(l,n.call(this,t+r,this.length));l.unshift.apply(l,n.call(this,0,t));l.unshift(0,this.length);i.apply(this,l);return e}return i.call(this,t,r)}}}if([].unshift(0)!==1){Array.prototype.unshift=function(){a.apply(this,arguments);return this.length}}if(!Array.isArray){Array.isArray=function Y(t){return f(t)==="[object Array]"}}var d=Object("a");var b=d[0]!=="a"||!(0 in d);var m=function q(t){var r=true;var e=true;if(t){t.call("foo",function(t,e,n){if(typeof n!=="object"){r=false}});t.call([1],function(){"use strict";e=typeof this==="string"},"x")}return!!t&&r&&e};if(!Array.prototype.forEach||!m(Array.prototype.forEach)){Array.prototype.forEach=function z(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=arguments[1],i=-1,o=e.length>>>0;if(!l(t)){throw new TypeError}while(++i<o){if(i in e){t.call(n,e[i],i,r)}}}}if(!Array.prototype.map||!m(Array.prototype.map)){Array.prototype.map=function K(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0,i=Array(n),o=arguments[1];if(!l(t)){throw new TypeError(t+" is not a function")}for(var a=0;a<n;a++){if(a in e)i[a]=t.call(o,e[a],a,r)}return i}}if(!Array.prototype.filter||!m(Array.prototype.filter)){Array.prototype.filter=function Q(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0,i=[],o,a=arguments[1];if(!l(t)){throw new TypeError(t+" is not a function")}for(var u=0;u<n;u++){if(u in e){o=e[u];if(t.call(a,o,u,r)){i.push(o)}}}return i}}if(!Array.prototype.every||!m(Array.prototype.every)){Array.prototype.every=function V(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0,i=arguments[1];if(!l(t)){throw new TypeError(t+" is not a function")}for(var o=0;o<n;o++){if(o in e&&!t.call(i,e[o],o,r)){return false}}return true}}if(!Array.prototype.some||!m(Array.prototype.some)){Array.prototype.some=function W(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0,i=arguments[1];if(!l(t)){throw new TypeError(t+" is not a function")}for(var o=0;o<n;o++){if(o in e&&t.call(i,e[o],o,r)){return true}}return false}}var w=false;if(Array.prototype.reduce){w=typeof Array.prototype.reduce.call("es5",function(t,r,e,n){return n})==="object"}if(!Array.prototype.reduce||!w){Array.prototype.reduce=function tr(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0;if(!l(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 o;if(arguments.length>=2){o=arguments[1]}else{do{if(i in e){o=e[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 e){o=t.call(void 0,o,e[i],i,r)}}return o}}var S=false;if(Array.prototype.reduceRight){S=typeof Array.prototype.reduceRight.call("es5",function(t,r,e,n){return n})==="object"}if(!Array.prototype.reduceRight||!S){Array.prototype.reduceRight=function rr(t){var r=H(this),e=b&&f(this)==="[object String]"?this.split(""):r,n=e.length>>>0;if(!l(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,o=n-1;if(arguments.length>=2){i=arguments[1]}else{do{if(o in e){i=e[o--];break}if(--o<0){throw new TypeError("reduceRight of empty array with no initial value")}}while(true)}if(o<0){return i}do{if(o in this){i=t.call(void 0,i,e[o],o,r)}}while(o--);return i}}if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!==-1){Array.prototype.indexOf=function er(t){var r=b&&f(this)==="[object String]"?this.split(""):H(this),e=r.length>>>0;if(!e){return-1}var n=0;if(arguments.length>1){n=G(arguments[1])}n=n>=0?n:Math.max(0,e+n);for(;n<e;n++){if(n in r&&r[n]===t){return n}}return-1}}if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!==-1){Array.prototype.lastIndexOf=function nr(t){var r=b&&f(this)==="[object String]"?this.split(""):H(this),e=r.length>>>0;if(!e){return-1}var n=e-1;if(arguments.length>1){n=Math.min(n,G(arguments[1]))}n=n>=0?n:e-Math.abs(n);for(;n>=0;n--){if(n in r&&t===r[n]){return n}}return-1}}if(!Object.keys){var x=!{toString:null}.propertyIsEnumerable("toString"),A=function(){}.propertyIsEnumerable("prototype"),j=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],E=j.length,N=function ir(t){var r=f(t);var e=r==="[object Arguments]";if(!e){e=!Array.isArray(r)&&t!==null&&typeof t==="object"&&typeof t.length==="number"&&t.length>=0&&l(t.callee)}return e};Object.keys=function or(t){var r=l(t),e=N(t),n=t!==null&&typeof t==="object",i=n&&f(t)==="[object String]";if(!n&&!r&&!e){throw new TypeError("Object.keys called on a non-object")}var o=[];var a=A&&r;if(i||e){for(var u=0;u<t.length;++u){o.push(String(u))}}else{for(var p in t){if(!(a&&p==="prototype")&&s(t,p)){o.push(String(p))}}}if(x){var c=t.constructor,h=c&&c.prototype===t;for(var y=0;y<E;y++){var g=j[y];if(!(h&&g==="constructor")&&s(t,g)){o.push(g)}}}return o}}var O=-621987552e5,T="-000001";if(!Date.prototype.toISOString||new Date(O).toISOString().indexOf(T)===-1){Date.prototype.toISOString=function ar(){var t,r,e,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);r=t.length;while(r--){e=t[r];if(e<10){t[r]="0"+e}}return n+"-"+t.slice(0,2).join("-")+"T"+t.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}}var I=false;try{I=Date.prototype.toJSON&&new Date(NaN).toJSON()===null&&new Date(O).toJSON().indexOf(T)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(D){}if(!I){Date.prototype.toJSON=function lr(t){var r=Object(this),e=B(r),n;if(typeof e==="number"&&!isFinite(e)){return null}n=r.toISOString;if(typeof n!=="function"){throw new TypeError("toISOString property is not callable")}return n.call(r)}}var _=Date.parse("+033658-09-27T01:46:40.000Z")===1e15;var M=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z"));var F=isNaN(Date.parse("2000-01-01T00:00:00.000Z"));if(!Date.parse||F||M||!_){Date=function(t){function r(e,n,i,o,a,l,u){var p=arguments.length;if(this instanceof t){var s=p===1&&String(e)===e?new t(r.parse(e)):p>=7?new t(e,n,i,o,a,l,u):p>=6?new t(e,n,i,o,a,l):p>=5?new t(e,n,i,o,a):p>=4?new t(e,n,i,o):p>=3?new t(e,n,i):p>=2?new t(e,n):p>=1?new t(e):new t;s.constructor=r;return s}return t.apply(this,arguments)}var e=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,r){var e=r>1?1:0;return n[r]+Math.floor((t-1969+e)/4)-Math.floor((t-1901+e)/100)+Math.floor((t-1601+e)/400)+365*(t-1970)}function o(r){return Number(new t(1970,0,1,0,0,0,r))}for(var a in t){r[a]=t[a]}r.now=t.now;r.UTC=t.UTC;r.prototype=t.prototype;r.prototype.constructor=r;r.parse=function l(r){var n=e.exec(r);if(n){var a=Number(n[1]),l=Number(n[2]||1)-1,u=Number(n[3]||1)-1,p=Number(n[4]||0),s=Number(n[5]||0),f=Number(n[6]||0),c=Math.floor(Number(n[7]||0)*1e3),h=Boolean(n[4]&&!n[8]),y=n[9]==="-"?1:-1,g=Number(n[10]||0),v=Number(n[11]||0),d;if(p<(s>0||f>0||c>0?24:25)&&s<60&&f<60&&c<1e3&&l>-1&&l<12&&g<24&&v<60&&u>-1&&u<i(a,l+1)-i(a,l)){d=((i(a,l)+u)*24+p+g*y)*60;d=((d+s+v*y)*60+f)*1e3+c;if(h){d=o(d)}if(-864e13<=d&&d<=864e13){return d}}return NaN}return t.parse.apply(this,arguments)};return r}(Date)}if(!Date.now){Date.now=function ur(){return(new Date).getTime()}}if(!Number.prototype.toFixed||8e-5.toFixed(3)!=="0.000"||.9.toFixed(0)==="0"||1.255.toFixed(2)!=="1.25"||0xde0b6b3a7640080.toFixed(0)!=="1000000000000000128"){(function(){var t,r,e,n;t=1e7;r=6;e=[0,0,0,0,0,0];function i(n,i){var o=-1;while(++o<r){i+=n*e[o];e[o]=i%t;i=Math.floor(i/t)}}function o(n){var i=r,o=0;while(--i>=0){o+=e[i];e[i]=Math.floor(o/n);o=o%n*t}}function a(){var t=r;var n="";while(--t>=0){if(n!==""||t===0||e[t]!==0){var i=String(e[t]);if(n===""){n=i}else{n+="0000000".slice(0,7-i.length)+i}}}return n}function l(t,r,e){return r===0?e:r%2===1?l(t,r-1,e*t):l(t*t,r/2,e)}function u(t){var r=0;while(t>=4096){r+=12;t/=4096}while(t>=2){r+=1;t/=2}return r}Number.prototype.toFixed=function p(t){var r,e,n,p,s,f,c,h;r=Number(t);r=r!==r?0:Math.floor(r);if(r<0||r>20){throw new RangeError("Number.toFixed called with invalid number of decimals")}e=Number(this);if(e!==e){return"NaN"}if(e<=-1e21||e>=1e21){return String(e)}n="";if(e<0){n="-";e=-e}p="0";if(e>1e-21){s=u(e*l(2,69,1))-69;f=s<0?e*l(2,-s,1):e/l(2,s,1);f*=4503599627370496;s=52-s;if(s>0){i(0,f);c=r;while(c>=7){i(1e7,0);c-=7}i(l(10,c,1),0);c=s-1;while(c>=23){o(1<<23);c-=23}o(1<<c);i(1,1);o(2);p=a()}else{i(0,f);i(1<<-s,0);p=a()+"0.00000000000000000000".slice(2,2+r)}}if(r>0){h=p.length;if(h<=r){p=n+"0.0000000000000000000".slice(0,r-h+2)+p}else{p=n+p.slice(0,h-r)+"."+p.slice(h-r)}}else{p=n+p}return p}})()}var R=String.prototype.split;if("ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||"tesst".split(/(s)*/)[1]==="t"||"".split(/.?/).length||".".split(/()()/).length>1){(function(){var t=/()??/.exec("")[1]===void 0;String.prototype.split=function(r,e){var n=this;if(r===void 0&&e===0)return[];if(f(r)!=="[object RegExp]"){return R.apply(this,arguments)}var i=[],o=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.extended?"x":"")+(r.sticky?"y":""),a=0,l,u,p,s;r=new RegExp(r.source,o+"g");n+="";if(!t){l=new RegExp("^"+r.source+"$(?!\\s)",o)}e=e===void 0?-1>>>0:e>>>0;while(u=r.exec(n)){p=u.index+u[0].length;if(p>a){i.push(n.slice(a,u.index));if(!t&&u.length>1){u[0].replace(l,function(){for(var t=1;t<arguments.length-2;t++){if(arguments[t]===void 0){u[t]=void 0}}})}if(u.length>1&&u.index<n.length){Array.prototype.push.apply(i,u.slice(1))}s=u[0].length;a=p;if(i.length>=e){break}}if(r.lastIndex===u.index){r.lastIndex++}}if(a===n.length){if(s||!r.test("")){i.push("")}}else{i.push(n.slice(a))}return i.length>e?i.slice(0,e):i}})()}else if("0".split(void 0,0).length){String.prototype.split=function pr(t,r){if(t===void 0&&r===0)return[];return R.apply(this,arguments)}}var C=String.prototype.replace;var k=function(){var t=[];"x".replace(/x(.)?/g,function(r,e){t.push(e)});return t.length===1&&typeof t[0]==="undefined"}();if(!k){String.prototype.replace=function sr(t,r){var e=l(r);var n=u(t)&&/\)[*?]/.test(t.source);if(!e||!n){return C.apply(this,arguments)}else{var i=function(e){var n=arguments.length;var i=t.lastIndex;t.lastIndex=0;var o=t.exec(e);t.lastIndex=i;o.push(arguments[n-2],arguments[n-1]);return r.apply(this,o)};return C.call(this,t,i)}}}if("".substr&&"0b".substr(-1)!=="b"){var U=String.prototype.substr;String.prototype.substr=function fr(t,r){return U.call(this,t<0?(t=this.length+t)<0?0:t:t,r)}}var Z=" \n\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003"+"\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028"+"\u2029\ufeff";var J="\u200b";if(!String.prototype.trim||Z.trim()||!J.trim()){Z="["+Z+"]";var X=new RegExp("^"+Z+Z+"*"),$=new RegExp(Z+Z+"*$");String.prototype.trim=function cr(){if(this===void 0||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(X,"").replace($,"")}}if(parseInt(Z+"08")!==8||parseInt(Z+"0x16")!==22){parseInt=function(t){var r=/^0[xX]/;return function e(n,i){n=String(n).trim();if(!Number(i)){i=r.test(n)?16:10}return t(n,i)}}(parseInt)}function G(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 P(t){var r=typeof t;return t===null||r==="undefined"||r==="boolean"||r==="number"||r==="string"}function B(t){var r,e,n;if(P(t)){return t}e=t.valueOf;if(l(e)){r=e.call(t);if(P(r)){return r}}n=t.toString;if(l(n)){r=n.call(t);if(P(r)){return r}}throw new TypeError}var H=function(t){if(t==null){throw new TypeError("can't convert "+t+" to object")}return Object(t)}}); | ||
//# sourceMappingURL=es5-shim.map |
{ | ||
"name": "es5-shim", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "ECMAScript 5 compatibility shims for legacy JavaScript engines", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/es-shims/es5-shim/", |
@@ -339,3 +339,3 @@ var toString = Object.prototype.toString; | ||
actual = testSubject.indexOf('hej'); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
@@ -345,3 +345,3 @@ it('should not find the element', function() { | ||
actual = testSubject.indexOf('mus'); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
@@ -351,3 +351,3 @@ it('should find undefined as well', function() { | ||
actual = testSubject.indexOf(undefined); | ||
expect(actual).not.toEqual(expected); | ||
expect(actual).not.toBe(expected); | ||
}); | ||
@@ -357,25 +357,25 @@ it('should skip unset indexes', function() { | ||
actual = testSubject.indexOf(undefined); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
it('should use a strict test', function() { | ||
actual = testSubject.indexOf(null); | ||
expect(actual).toEqual(5); | ||
expect(actual).toBe(5); | ||
actual = testSubject.indexOf('2'); | ||
expect(actual).toEqual(-1); | ||
expect(actual).toBe(-1); | ||
}); | ||
it('should skip the first if fromIndex is set', function() { | ||
expect(testSubject.indexOf(2, 2)).toEqual(6); | ||
expect(testSubject.indexOf(2, 0)).toEqual(0); | ||
expect(testSubject.indexOf(2, 6)).toEqual(6); | ||
expect(testSubject.indexOf(2, 2)).toBe(6); | ||
expect(testSubject.indexOf(2, 0)).toBe(0); | ||
expect(testSubject.indexOf(2, 6)).toBe(6); | ||
}); | ||
it('should work with negative fromIndex', function() { | ||
expect(testSubject.indexOf(2, -3)).toEqual(6); | ||
expect(testSubject.indexOf(2, -9)).toEqual(0); | ||
expect(testSubject.indexOf(2, -3)).toBe(6); | ||
expect(testSubject.indexOf(2, -9)).toBe(0); | ||
}); | ||
it('should work with fromIndex being greater than the length', function() { | ||
expect(testSubject.indexOf(0, 20)).toEqual(-1); | ||
expect(testSubject.indexOf(0, 20)).toBe(-1); | ||
}); | ||
it('should work with fromIndex being negative and greater than the length', function() { | ||
expect(testSubject.indexOf('hej', -20)).toEqual(4); | ||
expect(testSubject.indexOf('hej', -20)).toBe(4); | ||
}); | ||
@@ -397,3 +397,3 @@ | ||
actual = indexOf.call(testAL, 'hej'); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
@@ -403,3 +403,3 @@ it('should not find the element (array-like)', function() { | ||
actual = indexOf.call(testAL, 'mus'); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
@@ -409,3 +409,3 @@ it('should find undefined as well (array-like)', function() { | ||
actual = indexOf.call(testAL, undefined); | ||
expect(actual).not.toEqual(expected); | ||
expect(actual).not.toBe(expected); | ||
}); | ||
@@ -415,25 +415,25 @@ it('should skip unset indexes (array-like)', function() { | ||
actual = indexOf.call(testAL, undefined); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
it('should use a strict test (array-like)', function() { | ||
actual = Array.prototype.indexOf.call(testAL, null); | ||
expect(actual).toEqual(5); | ||
expect(actual).toBe(5); | ||
actual = Array.prototype.indexOf.call(testAL, '2'); | ||
expect(actual).toEqual(-1); | ||
expect(actual).toBe(-1); | ||
}); | ||
it('should skip the first if fromIndex is set (array-like)', function() { | ||
expect(indexOf.call(testAL, 2, 2)).toEqual(6); | ||
expect(indexOf.call(testAL, 2, 0)).toEqual(0); | ||
expect(indexOf.call(testAL, 2, 6)).toEqual(6); | ||
expect(indexOf.call(testAL, 2, 2)).toBe(6); | ||
expect(indexOf.call(testAL, 2, 0)).toBe(0); | ||
expect(indexOf.call(testAL, 2, 6)).toBe(6); | ||
}); | ||
it('should work with negative fromIndex (array-like)', function() { | ||
expect(indexOf.call(testAL, 2, -3)).toEqual(6); | ||
expect(indexOf.call(testAL, 2, -9)).toEqual(0); | ||
expect(indexOf.call(testAL, 2, -3)).toBe(6); | ||
expect(indexOf.call(testAL, 2, -9)).toBe(0); | ||
}); | ||
it('should work with fromIndex being greater than the length (array-like)', function() { | ||
expect(indexOf.call(testAL, 0, 20)).toEqual(-1); | ||
expect(indexOf.call(testAL, 0, 20)).toBe(-1); | ||
}); | ||
it('should work with fromIndex being negative and greater than the length (array-like)', function() { | ||
expect(indexOf.call(testAL, 'hej', -20)).toEqual(4); | ||
expect(indexOf.call(testAL, 'hej', -20)).toBe(4); | ||
}); | ||
@@ -455,3 +455,3 @@ }); | ||
actual = testSubject.lastIndexOf('hej'); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
@@ -461,3 +461,3 @@ it('should not find the element', function() { | ||
actual = testSubject.lastIndexOf('mus'); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
@@ -467,3 +467,3 @@ it('should find undefined as well', function() { | ||
actual = testSubject.lastIndexOf(undefined); | ||
expect(actual).not.toEqual(expected); | ||
expect(actual).not.toBe(expected); | ||
}); | ||
@@ -473,25 +473,25 @@ it('should skip unset indexes', function() { | ||
actual = testSubject.lastIndexOf(undefined); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
it('should use a strict test', function() { | ||
actual = testSubject.lastIndexOf(null); | ||
expect(actual).toEqual(5); | ||
expect(actual).toBe(5); | ||
actual = testSubject.lastIndexOf('2'); | ||
expect(actual).toEqual(-1); | ||
expect(actual).toBe(-1); | ||
}); | ||
it('should skip the first if fromIndex is set', function() { | ||
expect(testSubject.lastIndexOf(2, 2)).toEqual(0); | ||
expect(testSubject.lastIndexOf(2, 0)).toEqual(0); | ||
expect(testSubject.lastIndexOf(2, 6)).toEqual(6); | ||
expect(testSubject.lastIndexOf(2, 2)).toBe(0); | ||
expect(testSubject.lastIndexOf(2, 0)).toBe(0); | ||
expect(testSubject.lastIndexOf(2, 6)).toBe(6); | ||
}); | ||
it('should work with negative fromIndex', function() { | ||
expect(testSubject.lastIndexOf(2, -3)).toEqual(6); | ||
expect(testSubject.lastIndexOf(2, -9)).toEqual(0); | ||
expect(testSubject.lastIndexOf(2, -3)).toBe(6); | ||
expect(testSubject.lastIndexOf(2, -9)).toBe(0); | ||
}); | ||
it('should work with fromIndex being greater than the length', function() { | ||
expect(testSubject.lastIndexOf(2, 20)).toEqual(6); | ||
expect(testSubject.lastIndexOf(2, 20)).toBe(6); | ||
}); | ||
it('should work with fromIndex being negative and greater than the length', function() { | ||
expect(testSubject.lastIndexOf(2, -20)).toEqual(-1); | ||
expect(testSubject.lastIndexOf(2, -20)).toBe(-1); | ||
}); | ||
@@ -513,3 +513,3 @@ }); | ||
actual = lastIndexOf.call(testAL, 'hej'); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
@@ -519,3 +519,3 @@ it('should not find the element (array-like)', function() { | ||
actual = lastIndexOf.call(testAL, 'mus'); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
@@ -525,3 +525,3 @@ it('should find undefined as well (array-like)', function() { | ||
actual = lastIndexOf.call(testAL, undefined); | ||
expect(actual).not.toEqual(expected); | ||
expect(actual).not.toBe(expected); | ||
}); | ||
@@ -531,25 +531,25 @@ it('should skip unset indexes (array-like)', function() { | ||
actual = lastIndexOf.call(testAL, undefined); | ||
expect(actual).toEqual(expected); | ||
expect(actual).toBe(expected); | ||
}); | ||
it('should use a strict test (array-like)', function() { | ||
actual = lastIndexOf.call(testAL, null); | ||
expect(actual).toEqual(5); | ||
expect(actual).toBe(5); | ||
actual = lastIndexOf.call(testAL, '2'); | ||
expect(actual).toEqual(-1); | ||
expect(actual).toBe(-1); | ||
}); | ||
it('should skip the first if fromIndex is set', function() { | ||
expect(lastIndexOf.call(testAL, 2, 2)).toEqual(0); | ||
expect(lastIndexOf.call(testAL, 2, 0)).toEqual(0); | ||
expect(lastIndexOf.call(testAL, 2, 6)).toEqual(6); | ||
expect(lastIndexOf.call(testAL, 2, 2)).toBe(0); | ||
expect(lastIndexOf.call(testAL, 2, 0)).toBe(0); | ||
expect(lastIndexOf.call(testAL, 2, 6)).toBe(6); | ||
}); | ||
it('should work with negative fromIndex', function() { | ||
expect(lastIndexOf.call(testAL, 2, -3)).toEqual(6); | ||
expect(lastIndexOf.call(testAL, 2, -9)).toEqual(0); | ||
expect(lastIndexOf.call(testAL, 2, -3)).toBe(6); | ||
expect(lastIndexOf.call(testAL, 2, -9)).toBe(0); | ||
}); | ||
it('should work with fromIndex being greater than the length', function() { | ||
expect(lastIndexOf.call(testAL, 2, 20)).toEqual(6); | ||
expect(lastIndexOf.call(testAL, 2, 20)).toBe(6); | ||
}); | ||
it('should work with fromIndex being negative and greater than the length', function() { | ||
expect(lastIndexOf.call(testAL, 2, -20)).toEqual(-1); | ||
expect(lastIndexOf.call(testAL, 2, -20)).toBe(-1); | ||
}); | ||
@@ -1181,3 +1181,3 @@ }); | ||
it('should return length', function () { | ||
expect([].unshift(0)).toEqual(1); | ||
expect([].unshift(0)).toBe(1); | ||
}); | ||
@@ -1195,5 +1195,5 @@ }); | ||
while (l--) { | ||
a.unshift(prefix + Array(l + 1).join(" ") + l) | ||
a.unshift(prefix + Array(l + 1).join(" ") + l); | ||
} | ||
return a | ||
return a; | ||
}; | ||
@@ -1206,3 +1206,3 @@ | ||
it('has the right length', function () { | ||
expect(Array.prototype.splice.length).toEqual(2); | ||
expect(Array.prototype.splice.length).toBe(2); | ||
}); | ||
@@ -1213,2 +1213,3 @@ | ||
}); | ||
it('basic implementation test 2', function () { | ||
@@ -1220,63 +1221,57 @@ test.splice(0, 2); | ||
it('should return right result 1', function () { | ||
expect((function() { | ||
var array = []; | ||
var array = []; | ||
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(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"); | ||
return array.join("|"); | ||
}())).toBe("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"); | ||
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]); | ||
}); | ||
it('should return right result 2', function () { | ||
expect((function() { | ||
var array = makeArray(6); | ||
var array = makeArray(6); | ||
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(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"); | ||
return array.join("|"); | ||
}())).toBe("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(4, 0, "99999999999999"); | ||
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', '']); | ||
}); | ||
it('should return right result 3', function () { | ||
expect((function() { | ||
var array = [1,2,3]; | ||
var array = [1, 2, 3]; | ||
array.splice(0); | ||
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(0, 1); | ||
array.splice(0, 2); | ||
array.pop(); | ||
array.push.apply(array, makeArray(10, "-")); | ||
array.splice(array.length - 2, 10); | ||
array.splice(); | ||
array.splice(1, 1, 1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9); | ||
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",1,23,4,5,6,7,8); | ||
array.splice(30, 10); | ||
array.splice(30, 1); | ||
array.splice(30, 0); | ||
array.splice(2, 5, 1,2,3,"P", "LLL", "CCC", "YYY", "XXX"); | ||
array.push(1,2,3,4,5,6); | ||
array.splice(1, 6, 1,2,3,4,5,6,7,8,9,4,5,6,7,8,9); | ||
array.splice(3, 7); | ||
array.unshift(7,8,9,10,11); | ||
array.pop(); | ||
array.splice(5, 2); | ||
array.pop(); | ||
array.unshift.apply(array, makeArray(8, "~")); | ||
array.pop(); | ||
array.splice(3, 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",1,23,4,5,6,7,8); | ||
array.splice(4, 5, "P", "LLL", "CCC", "YYY", "XXX"); | ||
array.splice(0); | ||
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(0, 1); | ||
array.splice(0, 2); | ||
array.pop(); | ||
array.push.apply(array, makeArray(10, "-")); | ||
array.splice(array.length - 2, 10); | ||
array.splice(); | ||
array.splice(1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9); | ||
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', 1, 23, 4, 5, 6, 7, 8); | ||
array.splice(30, 10); | ||
array.splice(30, 1); | ||
array.splice(30, 0); | ||
array.splice(2, 5, 1, 2, 3, 'P', 'LLL', 'CCC', 'YYY', 'XXX'); | ||
array.push(1, 2, 3, 4, 5, 6); | ||
array.splice(1, 6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9); | ||
array.splice(3, 7); | ||
array.unshift(7, 8, 9, 10, 11); | ||
array.pop(); | ||
array.splice(5, 2); | ||
array.pop(); | ||
array.unshift.apply(array, makeArray(8, '~')); | ||
array.pop(); | ||
array.splice(3, 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', 1, 23, 4, 5, 6, 7, 8); | ||
array.splice(4, 5, 'P', 'LLL', 'CCC', 'YYY', 'XXX'); | ||
return array.join("|"); | ||
}())).toBe("~0|~ 1|~ 2|F1|P|LLL|CCC|YYY|XXX|F7|F8|F9|F10|F11|F12|F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|F25|F26|1|23|4|5|6|7|8|~ 4|~ 5|~ 6|~ 7|7|8|9|10|11|2|4|5|6|7|8|9|CCC|YYY|XXX|F7|F8|F9|F10|F11|F12|F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|F25|F26|1|23|4|9|10|1|2|3|4|5|6|7|8|9|YYY|XXX|F6|F7|F8|F9|F10|F11|F12|F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|F25|F26|3|4|5|6|7|8|9|-0|- 1|- 2|- 3|- 4|- 5|- 6|- 7|1|2|3"); | ||
expect(array).toEqual(['~0', '~ 1', '~ 2', 'F1', 'P', 'LLL', 'CCC', 'YYY', 'XXX', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F20', 'F21', 'F22', 'F23', 'F24', 'F25', 'F26', 1, 23, 4, 5, 6, 7, 8, '~ 4', '~ 5', '~ 6', '~ 7', 7, 8, 9, 10, 11, 2, 4, 5, 6, 7, 8, 9, 'CCC', 'YYY', 'XXX', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F20', 'F21', 'F22', 'F23', 'F24', 'F25', 'F26', 1, 23, 4, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'YYY', 'XXX', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F20', 'F21', 'F22', 'F23', 'F24', 'F25', 'F26', 3, 4, 5, 6, 7, 8, 9, '-0', '- 1', '- 2', '- 3', '- 4', '- 5', '- 6', '- 7', 1, 2, 3]); | ||
}); | ||
it('should do nothing if method called with no arguments', function () { | ||
@@ -1286,3 +1281,3 @@ expect(test.splice()).toEqual([]); | ||
}); | ||
//TODO:: Is this realy TRUE behavior? | ||
it('should set first argument to 0 if first argument is set but undefined', function () { | ||
@@ -1309,19 +1304,22 @@ var test2 = test.slice(0); | ||
test.splice.call(obj, 0, 0, 1, 2, 3); | ||
expect(obj.length).toEqual(3); | ||
expect(obj.length).toBe(3); | ||
}); | ||
it('should work with objects - adding 2', function () { | ||
var obj = {0:1, length: 1}; | ||
test.splice.call(obj, 1, 0, 2, 3); | ||
expect(obj.length).toEqual(3); | ||
expect(obj.length).toBe(3); | ||
}); | ||
it('should work with objects - removing', function () { | ||
var obj = {0:1, 1:2, 2: 3, length: 3}; | ||
test.splice.call(obj, 0, 3); | ||
expect(obj.length).toEqual(0); | ||
expect(obj.length).toBe(0); | ||
}); | ||
it('should work with objects - replacing', function () { | ||
var obj = {0:99, length: 1}; | ||
test.splice.call(obj, 0, 1, 1, 2, 3); | ||
expect(obj.length).toEqual(3); | ||
expect(obj[0]).toEqual(1); | ||
expect(obj.length).toBe(3); | ||
expect(obj[0]).toBe(1); | ||
}); | ||
@@ -1328,0 +1326,0 @@ }); |
@@ -5,3 +5,7 @@ describe('Date', function () { | ||
it('should be the current time', function () { | ||
expect(Date.now()).toBe(new Date().getTime()); | ||
var before = (new Date()).getTime(); | ||
var middle = Date.now(); | ||
var after = (new Date()).getTime(); | ||
expect(middle).not.toBeLessThan(before); | ||
expect(middle).not.toBeGreaterThan(after); | ||
}); | ||
@@ -8,0 +12,0 @@ }); |
@@ -8,8 +8,8 @@ describe('String', function() { | ||
expect(test.trim()).toEqual("Hello, World!"); | ||
expect(test.trim().length).toEqual(13); | ||
expect(test.trim().length).toBe(13); | ||
}); | ||
it('does not trim the zero-width space', function() { | ||
expect('\u200b'.trim()).toEqual('\u200b'); | ||
expect('\u200b'.trim().length).toEqual(1); | ||
expect('\u200b'.trim()).toBe('\u200b'); | ||
expect('\u200b'.trim().length).toBe(1); | ||
}); | ||
@@ -16,0 +16,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
375191