Use blocked scoped variables
In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
This commit is contained in:
+10
-10
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/geom/flat/length
|
||||
*/
|
||||
var _ol_geom_flat_length_ = {};
|
||||
const _ol_geom_flat_length_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -12,13 +12,13 @@ var _ol_geom_flat_length_ = {};
|
||||
* @return {number} Length.
|
||||
*/
|
||||
_ol_geom_flat_length_.lineString = function(flatCoordinates, offset, end, stride) {
|
||||
var x1 = flatCoordinates[offset];
|
||||
var y1 = flatCoordinates[offset + 1];
|
||||
var length = 0;
|
||||
var i;
|
||||
let x1 = flatCoordinates[offset];
|
||||
let y1 = flatCoordinates[offset + 1];
|
||||
let length = 0;
|
||||
let i;
|
||||
for (i = offset + stride; i < end; i += stride) {
|
||||
var x2 = flatCoordinates[i];
|
||||
var y2 = flatCoordinates[i + 1];
|
||||
const x2 = flatCoordinates[i];
|
||||
const y2 = flatCoordinates[i + 1];
|
||||
length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
@@ -35,10 +35,10 @@ _ol_geom_flat_length_.lineString = function(flatCoordinates, offset, end, stride
|
||||
* @return {number} Perimeter.
|
||||
*/
|
||||
_ol_geom_flat_length_.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
var perimeter =
|
||||
let perimeter =
|
||||
_ol_geom_flat_length_.lineString(flatCoordinates, offset, end, stride);
|
||||
var dx = flatCoordinates[end - stride] - flatCoordinates[offset];
|
||||
var dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1];
|
||||
const dx = flatCoordinates[end - stride] - flatCoordinates[offset];
|
||||
const dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1];
|
||||
perimeter += Math.sqrt(dx * dx + dy * dy);
|
||||
return perimeter;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user