was.js – Diff between revs 3 and 5

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 3 Rev 5
Line 10... Line 10...
10 new Array(Math.max(this.length, a.length)), 10 new Array(Math.max(this.length, a.length)),
11 function(e, i) { 11 function(e, i) {
12 var o = {}; 12 var o = {};
13 o[a[i]] = b[i]; 13 o[a[i]] = b[i];
14 return o; 14 return o;
15 }); 15 });
16 }; 16 };
17 } 17 }
18 $.extend({ 18 $.extend({
19 product: function(a, b) { 19 product: function(a, b) {
20 return $.map( 20 return $.map(
21 new Array(Math.max(this.length, a.length)), 21 new Array(Math.max(this.length, a.length)),
22 function(e, i) { 22 function(e, i) {
23 var o = {}; 23 var o = {};
24 o[a[i]] = b[i]; 24 o[a[i]] = b[i];
25 return o; 25 return o;
26 }); 26 });
27 } 27 }
28 }); 28 });
Line 29... Line 29...
29   29  
30 /*************************************************************************/ 30 /*************************************************************************/
Line 65... Line 65...
65 return [a.slice(0, n)] 65 return [a.slice(0, n)]
66 .concat(a.slice(n).chunk(n)); 66 .concat(a.slice(n).chunk(n));
67 } 67 }
68 }); 68 });
Line -... Line 69...
-   69  
-   70 /*************************************************************************/
-   71 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
-   72 /*************************************************************************/
-   73 /*stackoverflow.com/questions/7837456/how-to-compare-arrays-in-javascript*/
-   74 /*************************************************************************/
-   75 if (!Array.prototype.equals) {
-   76 // attach the .equals method to Array's prototype to call it on any array
-   77 Array.prototype.equals = function(a) {
-   78 // if the other array is a falsy value, return
-   79 if (!a) {
-   80 return false;
-   81 }
-   82  
-   83 // compare lengths - can save a lot of time
-   84 if (this.length !== a.length) {
-   85 return false;
-   86 }
-   87  
-   88 for (var i = 0, l = this.length; i < l; i++) {
-   89 // Check if we have nested arrays
-   90 if (this[i] instanceof Array && a[i] instanceof Array) {
-   91 // recurse into the nested arrays
-   92 if (!this[i].equals(a[i])) {
-   93 return false;
-   94 }
-   95 } else if (this[i] !== a[i]) {
-   96 // Warning - two different object instances will never be equal: {x:20} != {x:20}
-   97 return false;
-   98 }
-   99 }
-   100 return true;
-   101 };
-   102 }
-   103  
-   104 $.extend({
-   105 equals: function(a) {
-   106 // if the other array is a falsy value, return
-   107 if (!a) {
-   108 return false;
-   109 }
-   110  
-   111 // compare lengths - can save a lot of time
-   112 if (this.length !== a.length) {
-   113 return false;
-   114 }
-   115  
-   116 for (var i = 0, l = this.length; i < l; i++) {
-   117 // Check if we have nested arrays
-   118 if (this[i] instanceof Array && a[i] instanceof Array) {
-   119 // recurse into the nested arrays
-   120 if (!this[i].equals(a[i])) {
-   121 return false;
-   122 }
-   123 } else if (this[i] !== a[i]) {
-   124 // Warning - two different object instances will never be equal: {x:20} != {x:20}
-   125 return false;
-   126 }
-   127 }
-   128 return true;
-   129 }
-   130 });
69   131  
70 /////////////////////////////////////////////////////////////////////////// 132 ///////////////////////////////////////////////////////////////////////////
71 // Copyright (C) 2016 Wizardry and Steamworks - License: GNU GPLv3 // 133 // Copyright (C) 2016 Wizardry and Steamworks - License: GNU GPLv3 //
72 /////////////////////////////////////////////////////////////////////////// 134 ///////////////////////////////////////////////////////////////////////////
73 function wasCSVToArray(csv) { 135 function wasCSVToArray(csv) {