Better variables scoping

This commit is contained in:
Frederic Junod
2018-01-17 16:07:36 +01:00
parent 4a6331377f
commit 039d4dc714
22 changed files with 74 additions and 134 deletions

View File

@@ -99,8 +99,7 @@ MultiPolygon.prototype.appendPolygon = function(polygon) {
const offset = this.flatCoordinates.length;
extend(this.flatCoordinates, polygon.getFlatCoordinates());
ends = polygon.getEnds().slice();
let i, ii;
for (i = 0, ii = ends.length; i < ii; ++i) {
for (let i = 0, ii = ends.length; i < ii; ++i) {
ends[i] += offset;
}
}
@@ -293,8 +292,7 @@ MultiPolygon.prototype.getPolygon = function(index) {
const ends = this.endss_[index].slice();
const end = ends[ends.length - 1];
if (offset !== 0) {
let i, ii;
for (i = 0, ii = ends.length; i < ii; ++i) {
for (let i = 0, ii = ends.length; i < ii; ++i) {
ends[i] -= offset;
}
}
@@ -316,12 +314,11 @@ MultiPolygon.prototype.getPolygons = function() {
const endss = this.endss_;
const polygons = [];
let offset = 0;
let i, ii, j, jj;
for (i = 0, ii = endss.length; i < ii; ++i) {
for (let i = 0, ii = endss.length; i < ii; ++i) {
const ends = endss[i].slice();
const end = ends[ends.length - 1];
if (offset !== 0) {
for (j = 0, jj = ends.length; j < jj; ++j) {
for (let j = 0, jj = ends.length; j < jj; ++j) {
ends[j] -= offset;
}
}