stringifyForLogs more usual case first

This commit is contained in:
Simon Martín 2017-12-18 14:54:36 +01:00
parent 14e90a6c76
commit 77f64bee8c

View File

@ -198,14 +198,14 @@ function setErrorHeader(errors, 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, ' ');
}
});