Use const instead of var

This commit is contained in:
Daniel García Aubert 2019-09-13 18:00:13 +02:00
parent e8d5e42300
commit d99e5a44f5

View File

@ -1,9 +1,9 @@
'use strict';
var NamedMapMapConfigProvider = require('../models/mapconfig/provider/named-map-provider');
var templateName = require('../backends/template_maps').templateName;
const NamedMapMapConfigProvider = require('../models/mapconfig/provider/named-map-provider');
const templateName = require('../backends/template_maps').templateName;
var LruCache = require("lru-cache");
const LruCache = require("lru-cache");
const TEN_MINUTES_IN_MILLISECONDS = 1000 * 60 * 10;
const ACTIONS = ['update', 'delete'];
@ -31,9 +31,9 @@ function NamedMapProviderCache(
module.exports = NamedMapProviderCache;
NamedMapProviderCache.prototype.get = function(user, templateId, config, authToken, params, callback) {
var namedMapKey = createNamedMapKey(user, templateId);
var namedMapProviders = this.providerCache.get(namedMapKey) || {};
var providerKey = createProviderKey(config, authToken, params);
const namedMapKey = createNamedMapKey(user, templateId);
const namedMapProviders = this.providerCache.get(namedMapKey) || {};
const providerKey = createProviderKey(config, authToken, params);
if (namedMapProviders.hasOwnProperty(providerKey)) {
return callback(null, namedMapProviders[providerKey]);
@ -66,7 +66,7 @@ function createNamedMapKey(user, templateId) {
return user + ':' + templateName(templateId);
}
var providerKeyTpl = ctx => `${ctx.authToken}:${ctx.configHash}:${ctx.format}:${ctx.layer}:${ctx.scale_factor}`;
const providerKeyTpl = ctx => `${ctx.authToken}:${ctx.configHash}:${ctx.format}:${ctx.layer}:${ctx.scale_factor}`;
function createProviderKey(config, authToken, params) {
const defaults = {