Skip to content

Commit

Permalink
some random optimizations
Browse files Browse the repository at this point in the history
Hopefully…
  • Loading branch information
TooTallNate committed Nov 7, 2016
1 parent 54b1a5a commit 475e7b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions debug.js
Expand Up @@ -83,7 +83,10 @@ function debug(namespace) {
if (null == self.useColors) self.useColors = exports.useColors();
if (null == self.color && self.useColors) self.color = selectColor();

var args = Array.prototype.slice.call(arguments);
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}

args[0] = exports.coerce(args[0]);

Expand All @@ -110,9 +113,9 @@ function debug(namespace) {
return match;
});

if ('function' === typeof exports.formatArgs) {
args = exports.formatArgs.apply(self, args);
}
// apply env-specific formatting
args = exports.formatArgs.apply(self, args);

var logFn = enabled.log || exports.log || console.log.bind(console);
logFn.apply(self, args);
}
Expand Down
4 changes: 2 additions & 2 deletions node.js
Expand Up @@ -80,12 +80,12 @@ exports.formatters.o = exports.formatters.O = function(v) {
*/

function formatArgs() {
var args = [];
var len = arguments.length;
var args = new Array(len);
var useColors = this.useColors;
var name = this.namespace;
for (var i = 0; i < len; i++) {
args.push(arguments[i]);
args[i] = arguments[i];
}

if (useColors) {
Expand Down

0 comments on commit 475e7b3

Please sign in to comment.