Apply automatic eslint fixes

This commit is contained in:
Daniel García Aubert
2019-10-21 19:07:24 +02:00
parent 593d9e40f6
commit 4d70ac0894
246 changed files with 11782 additions and 11454 deletions
+22 -13
View File
@@ -21,7 +21,7 @@ const DEFAULT_ZOOM_CENTER = {
}
};
function numMapper(n) {
function numMapper (n) {
return +n;
}
@@ -60,7 +60,8 @@ module.exports = class PreviewTemplateController {
checkStaticImageFormat(),
namedMapProvider({
namedMapProviderCache: this.namedMapProviderCache,
label: 'STATIC_VIZ_MAP', forcedFormat: 'png'
label: 'STATIC_VIZ_MAP',
forcedFormat: 'png'
}),
getTemplate({ label: 'STATIC_VIZ_MAP' }),
prepareLayerFilterFromPreviewLayers({
@@ -109,8 +110,8 @@ function prepareLayerFilterFromPreviewLayers ({ namedMapProviderCache, label })
var layerVisibilityFilter = [];
template.layergroup.layers.forEach((layer, index) => {
if (previewLayers[''+index] !== false && previewLayers[layer.id] !== false) {
layerVisibilityFilter.push(''+index);
if (previewLayers['' + index] !== false && previewLayers[layer.id] !== false) {
layerVisibilityFilter.push('' + index);
}
});
@@ -123,9 +124,17 @@ function prepareLayerFilterFromPreviewLayers ({ namedMapProviderCache, label })
const { template_id, format } = req.params;
const params = {
user, token, cache_buster, api_key,
dbuser, dbname, dbpassword, dbhost, dbport,
template_id, format
user,
token,
cache_buster,
api_key,
dbuser,
dbname,
dbpassword,
dbhost,
dbport,
template_id,
format
};
// overwrites 'all' default filter
@@ -146,7 +155,7 @@ function prepareLayerFilterFromPreviewLayers ({ namedMapProviderCache, label })
}
function getStaticImageOptions ({ tablesExtentBackend }) {
return function getStaticImageOptionsMiddleware(req, res, next) {
return function getStaticImageOptionsMiddleware (req, res, next) {
const { user, mapConfigProvider, template } = res.locals;
const { zoom, lon, lat, bbox } = req.query;
const params = { zoom, lon, lat, bbox };
@@ -248,7 +257,7 @@ function getImageOptionsFromBoundingBox (bbox = '') {
}
}
function getImage({ previewBackend, label }) {
function getImage ({ previewBackend, label }) {
return function getImageMiddleware (req, res, next) {
const { imageOpts, mapConfigProvider } = res.locals;
const { zoom, center, bbox } = imageOpts;
@@ -298,7 +307,7 @@ function getImage({ previewBackend, label }) {
}
function setContentTypeHeader () {
return function setContentTypeHeaderMiddleware(req, res, next) {
return function setContentTypeHeaderMiddleware (req, res, next) {
const format = req.params.format === 'jpg' ? 'jpeg' : 'png';
res.set('Content-Type', `image/${format}`);
@@ -312,7 +321,7 @@ function incrementMapViewsError (ctx) {
}
function incrementMapViews ({ metadataBackend }) {
return function incrementMapViewsMiddleware(req, res, next) {
return function incrementMapViewsMiddleware (req, res, next) {
const { user, mapConfigProvider } = res.locals;
mapConfigProvider.getMapConfig((err, mapConfig) => {
@@ -334,7 +343,7 @@ function incrementMapViews ({ metadataBackend }) {
};
}
function templateZoomCenter(view) {
function templateZoomCenter (view) {
if (view.zoom !== undefined && view.center) {
return {
zoom: view.zoom,
@@ -344,7 +353,7 @@ function templateZoomCenter(view) {
return false;
}
function templateBounds(view) {
function templateBounds (view) {
if (view.bounds) {
var hasAllBounds = ['west', 'south', 'east', 'north'].every(prop => Number.isFinite(view.bounds[prop]));