From 41fad19b9b1752556c22ad57537ddca4ced3e1e1 Mon Sep 17 00:00:00 2001 From: AndriiHeonia Date: Sat, 24 Oct 2020 23:46:04 +0200 Subject: [PATCH] adjust code style and regenerate dist --- dist/hull.js | 7 +++++-- src/grid.js | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dist/hull.js b/dist/hull.js index 0380bb8..9f6fff1 100755 --- a/dist/hull.js +++ b/dist/hull.js @@ -101,7 +101,10 @@ 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]); + } } } @@ -113,7 +116,7 @@ Grid.prototype = { const cellY = this.coordToCellNum(point[1]); const cell = this._cells[cellX][cellY]; let pointIdxInCell; - + for (let i = 0; i < cell.length; i++) { if (cell[i][0] === point[0] && cell[i][1] === point[1]) { pointIdxInCell = i; diff --git a/src/grid.js b/src/grid.js index 3e83f80..3d6c3c5 100644 --- a/src/grid.js +++ b/src/grid.js @@ -33,9 +33,8 @@ Grid.prototype = { for (let x = tlCellX; x <= brCellX; x++) { for (let y = tlCellY; y <= brCellY; 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++){ + for (let i = 0; i < this.cellPoints(x, y).length; i++) { points.push(this.cellPoints(x, y)[i]); } } @@ -49,7 +48,7 @@ Grid.prototype = { const cellY = this.coordToCellNum(point[1]); const cell = this._cells[cellX][cellY]; let pointIdxInCell; - + for (let i = 0; i < cell.length; i++) { if (cell[i][0] === point[0] && cell[i][1] === point[1]) { pointIdxInCell = i;