From db73b661fddf9fa4dc035d97207360b047fcb684 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Sun, 30 Mar 2014 08:56:39 -0700 Subject: [PATCH] refactor --- lib/debug.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/debug.js b/lib/debug.js index dda1050..dca4f34 100644 --- a/lib/debug.js +++ b/lib/debug.js @@ -138,19 +138,21 @@ function coerce(val) { /** * Enable specified `namespaces` for debugging. */ + debug.enable = function(namespaces) { namespaces.split(/[\s,]+/) - .forEach(function(name){ - name = name.replace('*', '.*?'); - if (name[0] === '-') { - skips.push(new RegExp('^' + name.substr(1) + '$')); - } else { - names.push(new RegExp('^' + name + '$')); - } - }) + .forEach(function(name){ + name = name.replace('*', '.*?'); + if (name[0] == '-') { + skips.push(new RegExp('^' + name.substr(1) + '$')); + } else { + names.push(new RegExp('^' + name + '$')); + } + }); }; /** * Enable namespaces listed in `process.env.DEBUG` initially. */ -debug.enable(process.env.DEBUG || ''); \ No newline at end of file + +debug.enable(process.env.DEBUG || '');