was.js – Diff between revs 49 and 51

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 49 Rev 51
Line 1... Line 1...
1 /*! was.js - v1.0.7 - 2020-12-08 1 /*! was.js - v1.0.8 - 2020-12-08
2 * http://grimore.org 2 * http://grimore.org
3 * Copyright (c) 2020 [object Object]; Licensed GPL-3.0 */ 3 * Copyright (c) 2020 [object Object]; Licensed GPL-3.0 */
4 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 4 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
5 /*************************************************************************/ 5 /*************************************************************************/
6 function wasProduct(a, b) { 6 function wasProduct(a, b) {
Line 43... Line 43...
43 }); 43 });
44 } 44 }
Line 45... Line 45...
45   45  
46 // Vanilla JavaScript 46 // Vanilla JavaScript
47 function wasChunk(a, n) { 47 function wasChunk(a, n) {
48 return new Array.from(new Array(Math.ceil(a.length/n)), (_,i)=>a.slice(i*n,i*n+n)); 48 return Array.from(new Array(Math.ceil(a.length/n)), (_,i)=>a.slice(i*n,i*n+n));
49 } 49 }
50 if (!Array.prototype.chunk) { 50 if (!Array.prototype.chunk) {
51 Array.prototype.chunk = function(a, n) { 51 Array.prototype.chunk = function(a, n) {
52 return wasChunk(this, n); 52 return wasChunk(this, n);