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) {
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);