mirror of
https://github.com/debug-js/debug.git
synced 2025-12-08 20:59:48 +00:00
debug: remove hacky placeholder logic
@visionmedia pointed out that it is not necessary, which is good because it was very hacky.
This commit is contained in:
parent
b38496e03b
commit
652feca774
7
debug.js
7
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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user