Use spread operator

This commit is contained in:
Daniel García Aubert 2018-03-16 14:20:41 +01:00
parent 0aa8d63a6e
commit 67d2d2fe95

View File

@ -20,11 +20,7 @@ module.exports = function cleanUpQueryParamsMiddleware (customQueryParams = [])
} }
return function cleanUpQueryParams (req, res, next) { return function cleanUpQueryParams (req, res, next) {
var allowedQueryParams = REQUEST_QUERY_PARAMS_WHITELIST; const allowedQueryParams = [...REQUEST_QUERY_PARAMS_WHITELIST, ...customQueryParams];
if (Array.isArray(customQueryParams)) {
allowedQueryParams = allowedQueryParams.concat(customQueryParams);
}
req.query = _.pick(req.query, allowedQueryParams); req.query = _.pick(req.query, allowedQueryParams);