commit 71ebc2259299a1e367b917cba2544f39ff8f6619
parent 0ea2afea003a7d69c37600434257fe5af7eb650a
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Sun, 5 Jan 2020 14:15:54 +0100
fix lint errors (no-else-return)
Diffstat:
13 files changed, 40 insertions(+), 57 deletions(-)
diff --git a/src/lib/leaflet.control.elevation-profile/index.js b/src/lib/leaflet.control.elevation-profile/index.js
@@ -89,12 +89,11 @@ function offestFromEvent(e) {
offsetX: e.clientX - rect.left,
offestY: e.clientY - rect.top
};
- } else {
- return {
- offsetX: e.offsetX,
- offestY: e.offsetY
- };
}
+ return {
+ offsetX: e.offsetX,
+ offestY: e.offsetY
+ };
}
function movementFromEvents(e1, e2) {
diff --git a/src/lib/leaflet.control.jnx/hash-state.js b/src/lib/leaflet.control.jnx/hash-state.js
@@ -54,9 +54,8 @@ L.Control.JNX.include({
this.removeSelector();
this.addSelector([[south, west], [north, east]]);
return true;
- } else {
- return false;
}
+ return false;
}
}
);
diff --git a/src/lib/leaflet.control.jnx/jnx-maker.js b/src/lib/leaflet.control.jnx/jnx-maker.js
@@ -51,9 +51,8 @@ function ensureImageJpg(image) {
} else if (arrayBufferToString(image.slice(0, 2)) === '\xff\xd8' &&
arrayBufferToString(image.slice(-2)) === '\xff\xd9') {
return Promise.resolve(image);
- } else {
- return null;
}
+ return null;
}
async function makeJnxFromLayer(srcLayer, layerName, maxZoomLevel, latLngBounds, progress) {
diff --git a/src/lib/leaflet.control.panoramas/lib/google/index.js b/src/lib/leaflet.control.panoramas/lib/google/index.js
@@ -30,9 +30,8 @@ async function getPanoramaAtPos(latlng, searchRadiusMeters) {
);
if (status === google.maps.StreetViewStatus.OK) {
return {found: true, data};
- } else {
- return {found: false};
}
+ return {found: false};
}
@@ -83,9 +82,8 @@ const Viewer = L.Evented.extend({
if (pos && pov) {
return [pos.lat().toFixed(6), pos.lng().toFixed(6),
(pov.heading || 0).toFixed(1), (pov.pitch || 0).toFixed(1), (pov.zoom || 1).toFixed(1)];
- } else {
- return null;
}
+ return null;
},
setState: function(state) {
diff --git a/src/lib/leaflet.control.panoramas/lib/wikimedia/index.js b/src/lib/leaflet.control.panoramas/lib/wikimedia/index.js
@@ -91,9 +91,8 @@ function isCloser(target, a, b) {
return -1;
} else if (d1 === d2) {
return 0;
- } else {
- return 1;
}
+ return 1;
}
async function getPanoramaAtPos(latlng, searchRadiusMeters) {
@@ -126,10 +125,9 @@ async function getPanoramaAtPos(latlng, searchRadiusMeters) {
found: true,
data: photos
};
- } else {
- return {found: false};
}
-
+ return {found: false};
+
}
return {found: false};
}
@@ -140,9 +138,8 @@ function formatDateTime(dateStr) {
if (m) {
let [year, month, day] = m.slice(1);
return `${day} ${months[month - 1]} ${year}`;
- } else {
- return dateStr;
}
+ return dateStr;
}
const Viewer = L.Evented.extend({
diff --git a/src/lib/leaflet.control.printPages/decoration.scale.js b/src/lib/leaflet.control.printPages/decoration.scale.js
@@ -27,16 +27,15 @@ function formatScale(nominalScale, scaleRange) {
unit = 'm';
}
return `${scaleRange.min} – ${scaleRange.max} ${unit} in 1 cm`;
+ }
+ let unit;
+ if (nominalScale >= 1000) {
+ nominalScale /= 1000;
+ unit = 'km';
} else {
- let unit;
- if (nominalScale >= 1000) {
- nominalScale /= 1000;
- unit = 'km';
- } else {
- unit = 'm';
- }
- return `${nominalScale} ${unit} in 1 cm`;
+ unit = 'm';
}
+ return `${nominalScale} ${unit} in 1 cm`;
}
diff --git a/src/lib/leaflet.control.track-list/lib/parsers/nktk.js b/src/lib/leaflet.control.track-list/lib/parsers/nktk.js
@@ -305,9 +305,8 @@ function parseNktkFragment(s) {
return parseNktkOld(s.substring(reader.position), version);
} else if (version === 4) {
return parseNktkProtobuf(s.substring(reader.position));
- } else {
- return [{name: 'Text encoded track', error: ['CORRUPT']}];
}
+ return [{name: 'Text encoded track', error: ['CORRUPT']}];
}
function parseNktkSequence(s) {
diff --git a/src/lib/leaflet.control.track-list/track-list.js b/src/lib/leaflet.control.track-list/track-list.js
@@ -186,9 +186,8 @@ L.Control.TrackList = L.Control.extend({
this_.loadFilesFromUrl();
L.DomEvent.stop(e);
return false;
- } else {
- return true;
}
+ return true;
},
getTrackPolylines: function(track) {
diff --git a/src/lib/leaflet.layer.canvasMarkers/index.js b/src/lib/leaflet.layer.canvasMarkers/index.js
@@ -170,9 +170,8 @@ L.Layer.CanvasMarkers = L.GridLayer.extend({
}
}
);
- } else {
- return Promise.resolve();
}
+ return Promise.resolve();
},
createTile: function(coords, done) {
diff --git a/src/lib/leaflet.layer.rasterize/Bing.js b/src/lib/leaflet.layer.rasterize/Bing.js
@@ -5,18 +5,17 @@ BingLayer.include({
waitTilesReadyToGrab: function() {
if (this._url) {
return Promise.resolve();
- } else {
- return new Promise((resolve) => {
- let i = setInterval(() => {
- if (this._url) {
- clearInterval(i);
- resolve();
- }
- }, 50
- );
- }
- );
}
+ return new Promise((resolve) => {
+ let i = setInterval(() => {
+ if (this._url) {
+ clearInterval(i);
+ resolve();
+ }
+ }, 50
+ );
+ }
+ );
},
cloneForPrint: function(options) {
diff --git a/src/lib/leaflet.layer.rasterize/imgFromDataString.js b/src/lib/leaflet.layer.rasterize/imgFromDataString.js
@@ -15,9 +15,8 @@ function imgFromDataString(xhr) {
);
image.src = blobUrl;
return promise;
- } else {
- return null;
}
+ return null;
}
export {imgFromDataString};
diff --git a/src/lib/leaflet.layer.wikimapia/wikimapia-loader.js b/src/lib/leaflet.layer.wikimapia/wikimapia-loader.js
@@ -54,9 +54,7 @@ class WikimapiaLoader extends TiledDataLoader {
z: z2
};
}
- else {
- return {z, x: layerTileCoords.x, y: layerTileCoords.y};
- }
+ return {z, x: layerTileCoords.x, y: layerTileCoords.y};
}
makeRequestData(dataTileCoords) {
diff --git a/src/lib/tiled-data-loader/index.js b/src/lib/tiled-data-loader/index.js
@@ -49,14 +49,13 @@ class TiledDataLoader {
if (dataTileCoords.z > layerTileCoords.z) {
const multiplier = 1 << (dataTileCoords.z - layerTileCoords.z);
return {multiplier: 1 / multiplier, offsetX: 0, offsetY: 0};
- } else {
- const multiplier = 1 << (layerTileCoords.z - dataTileCoords.z);
- return {
- multiplier,
- offsetX: (layerTileCoords.x - dataTileCoords.x * multiplier),
- offsetY: (layerTileCoords.y - dataTileCoords.y * multiplier)
- };
}
+ const multiplier = 1 << (layerTileCoords.z - dataTileCoords.z);
+ return {
+ multiplier,
+ offsetX: (layerTileCoords.x - dataTileCoords.x * multiplier),
+ offsetY: (layerTileCoords.y - dataTileCoords.y * multiplier)
+ };
}
requestTileData(layerTileCoords) {