Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #16 from casvanluijtelaar/master
Browse files Browse the repository at this point in the history
replaced Array.prototype.push.apply to avoid hitting stack size limit
  • Loading branch information
andriiheonia authored Oct 24, 2020
2 parents 1ce2b41 + b0cfa30 commit 827fc41
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
}

Expand Down

0 comments on commit 827fc41

Please sign in to comment.