From ee511d3762513e7fbb7c0086d1f8e88ec8313546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Mart=C3=ADn?= Date: Mon, 18 Dec 2017 14:54:23 +0100 Subject: [PATCH] stringifyForLogs more usual case first --- app/utils/error_handler.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/utils/error_handler.js b/app/utils/error_handler.js index e63a5f1a..9d472aec 100644 --- a/app/utils/error_handler.js +++ b/app/utils/error_handler.js @@ -77,14 +77,14 @@ function setErrorHeader(err, statusCode, res) { */ function stringifyForLogs(object) { Object.keys(object).map(key => { - if (typeof object[key] === 'object') { + if(typeof object[key] === 'string') { + object[key] = object[key].replace(/[^a-zA-Z0-9]/g, ' '); + } else if (typeof object[key] === 'object') { stringifyForLogs(object[key]); } else if (object[key] instanceof Array) { for (let element of object[key]) { stringifyForLogs(element); } - } else if(typeof object[key] === 'string') { - object[key] = object[key].replace(/[^a-zA-Z0-9]/g, ' '); } });