From 67d2d2fe9549b70998b7cdd24e646e5a70671171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 16 Mar 2018 14:20:41 +0100 Subject: [PATCH] Use spread operator --- lib/cartodb/middleware/clean-up-query-params.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/cartodb/middleware/clean-up-query-params.js b/lib/cartodb/middleware/clean-up-query-params.js index 2553380d..d5c93c07 100644 --- a/lib/cartodb/middleware/clean-up-query-params.js +++ b/lib/cartodb/middleware/clean-up-query-params.js @@ -20,11 +20,7 @@ module.exports = function cleanUpQueryParamsMiddleware (customQueryParams = []) } return function cleanUpQueryParams (req, res, next) { - var allowedQueryParams = REQUEST_QUERY_PARAMS_WHITELIST; - - if (Array.isArray(customQueryParams)) { - allowedQueryParams = allowedQueryParams.concat(customQueryParams); - } + const allowedQueryParams = [...REQUEST_QUERY_PARAMS_WHITELIST, ...customQueryParams]; req.query = _.pick(req.query, allowedQueryParams);