stringifyForLogs more usual case first

This commit is contained in:
Simon Martín 2017-12-18 14:54:23 +01:00
parent b531922459
commit ee511d3762

View File

@ -77,14 +77,14 @@ function setErrorHeader(err, statusCode, res) {
*/ */
function stringifyForLogs(object) { function stringifyForLogs(object) {
Object.keys(object).map(key => { 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]); stringifyForLogs(object[key]);
} else if (object[key] instanceof Array) { } else if (object[key] instanceof Array) {
for (let element of object[key]) { for (let element of object[key]) {
stringifyForLogs(element); stringifyForLogs(element);
} }
} else if(typeof object[key] === 'string') {
object[key] = object[key].replace(/[^a-zA-Z0-9]/g, ' ');
} }
}); });