Use Object.assign() instead of _.defaults()
This commit is contained in:
parent
c0afd42fa2
commit
e8d5e42300
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var _ = require('underscore');
|
|
||||||
var NamedMapMapConfigProvider = require('../models/mapconfig/provider/named-map-provider');
|
var NamedMapMapConfigProvider = require('../models/mapconfig/provider/named-map-provider');
|
||||||
var templateName = require('../backends/template_maps').templateName;
|
var templateName = require('../backends/template_maps').templateName;
|
||||||
|
|
||||||
@ -70,12 +69,14 @@ function createNamedMapKey(user, templateId) {
|
|||||||
var providerKeyTpl = ctx => `${ctx.authToken}:${ctx.configHash}:${ctx.format}:${ctx.layer}:${ctx.scale_factor}`;
|
var providerKeyTpl = ctx => `${ctx.authToken}:${ctx.configHash}:${ctx.format}:${ctx.layer}:${ctx.scale_factor}`;
|
||||||
|
|
||||||
function createProviderKey(config, authToken, params) {
|
function createProviderKey(config, authToken, params) {
|
||||||
var tplValues = _.defaults({}, params, {
|
const defaults = {
|
||||||
authToken: authToken || '',
|
authToken: authToken || '',
|
||||||
configHash: NamedMapMapConfigProvider.configHash(config),
|
configHash: NamedMapMapConfigProvider.configHash(config),
|
||||||
layer: '',
|
layer: '',
|
||||||
format: '',
|
format: '',
|
||||||
scale_factor: 1
|
scale_factor: 1
|
||||||
});
|
};
|
||||||
return providerKeyTpl(tplValues);
|
const ctx = Object.assign({}, defaults, params);
|
||||||
|
|
||||||
|
return providerKeyTpl(ctx);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user