From c637caf9c9bc0ca57bcc58063a84e35d9b7e1214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Tue, 12 Dec 2017 10:56:23 +0100 Subject: [PATCH] Replace nested conditional with guard clause --- .../adapter/aggregation-mapconfig-adapter.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js b/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js index 115632df..eed51dbf 100644 --- a/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js +++ b/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js @@ -89,12 +89,14 @@ module.exports = class AggregationMapConfigAdapter { return shouldAdapt; } - if (aggregation === undefined) { - if (mapConfig.isVectorOnlyMapConfig()) { - shouldAdapt = true; - } else if (this._hasAnyLayerAggregation(requestMapConfig)){ - shouldAdapt = true; - } + if (aggregation === undefined && mapConfig.isVectorOnlyMapConfig()) { + shouldAdapt = true; + return shouldAdapt; + } + + if (aggregation === undefined && this._hasAnyLayerAggregation(requestMapConfig)){ + shouldAdapt = true; + return shouldAdapt; } return shouldAdapt;