From b0cfa303cff60d9caf6749151e6f6cb649a1e567 Mon Sep 17 00:00:00 2001 From: cas van luijtelaar Date: Sat, 12 Sep 2020 10:38:35 +0200 Subject: [PATCH] replaced Array.prototype.push.apply to avoid hitting stack size limit on larger arrays. --- src/grid.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/grid.js b/src/grid.js index 86c8c3a..3e83f80 100644 --- a/src/grid.js +++ b/src/grid.js @@ -33,7 +33,11 @@ Grid.prototype = { for (let x = tlCellX; x <= brCellX; x++) { for (let y = tlCellY; y <= brCellY; y++) { - Array.prototype.push.apply(points, this.cellPoints(x, y)); + + // replaced Array.prototype.push.apply to avoid hitting stack size limit on larger arrays. + for(let i = 0; i < this.cellPoints(x, y).length; i++){ + points.push(this.cellPoints(x, y)[i]); + } } }