Return 'null' explicitly

This commit is contained in:
Daniel García Aubert
2018-05-30 17:09:01 +02:00
parent d8b0d338c0
commit 532d50ad7a
2 changed files with 18 additions and 21 deletions
@@ -44,7 +44,7 @@ CreateLayergroupMapConfigProvider.prototype.getMapConfig = function(callback) {
context.limits = renderLimits;
this.context = context;
return callback(err, this.mapConfig, this.params, context);
return callback(null, this.mapConfig, this.params, context);
});
};
@@ -28,33 +28,30 @@ function MapStoreMapConfigProvider(mapStore, user, userLimitsBackend, pgConnecti
module.exports = MapStoreMapConfigProvider;
MapStoreMapConfigProvider.prototype.getMapConfig = function(callback) {
var self = this;
if (this.mapConfig !== null) {
return callback(null, this.mapConfig, this.params, this.context);
}
var context = {};
step(
function prepareContextLimits() {
self.userLimitsBackend.getRenderLimits(self.user, self.params.api_key, this);
},
function handleRenderLimits(err, renderLimits) {
assert.ifError(err);
context.limits = renderLimits;
return null;
},
function loadMapConfig(err) {
assert.ifError(err);
self.mapStore.load(self.token, this);
},
function finish(err, mapConfig) {
self.mapConfig = mapConfig;
self.context = context;
return callback(err, mapConfig, self.params, context);
this.userLimitsBackend.getRenderLimits(this.user, this.params.api_key, (err, renderLimits) => {
if (err) {
return callback(err);
}
);
context.limits = renderLimits;
this.mapStore.load(this.token, (err, mapConfig) => {
if (err) {
return callback(err);
}
this.mapConfig = mapConfig;
this.context = context;
return callback(null, mapConfig, this.params, context);
});
});
};
MapStoreMapConfigProvider.prototype.getKey = function() {