From 652feca774e855d40c1caa051c8e8dd72cdd1d2a Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Sat, 31 May 2014 18:57:30 -0700 Subject: [PATCH] debug: remove hacky placeholder logic @visionmedia pointed out that it is not necessary, which is good because it was very hacky. --- debug.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/debug.js b/debug.js index fc2ddb0..42831cf 100644 --- a/debug.js +++ b/debug.js @@ -56,9 +56,8 @@ function debug(namespace) { // apply any `formatters` transformations var index = 0; args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { - // replace "%%" with a placeholder value for now. - // we restore it after doing the formatters parsing. - if (match === '%%') return '68ddd49c85cb46fc8c'; + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; index++; var formatter = exports.formatters[format]; if ('function' === typeof formatter) { @@ -70,7 +69,7 @@ function debug(namespace) { index--; } return match; - }).replace(/68ddd49c85cb46fc8c/g, '%%'); + }); exports.log.apply(enabled, args); }