Skip to content

Commit

Permalink
console: name anonymous functions
Browse files Browse the repository at this point in the history
Ref: #8913
PR-URL: #9047
Reviewed-By: Ilkka Myller <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
tylerbrazier authored and jasnell committed Oct 17, 2016
1 parent b0da431 commit bd7d7a7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,34 @@ function Console(stdout, stderr) {
// As of v8 5.0.71.32, the combination of rest param, template string
// and .apply(null, args) benchmarks consistently faster than using
// the spread operator when calling util.format.
Console.prototype.log = function(...args) {
Console.prototype.log = function log(...args) {
this._stdout.write(`${util.format.apply(null, args)}\n`);
};


Console.prototype.info = Console.prototype.log;


Console.prototype.warn = function(...args) {
Console.prototype.warn = function warn(...args) {
this._stderr.write(`${util.format.apply(null, args)}\n`);
};


Console.prototype.error = Console.prototype.warn;


Console.prototype.dir = function(object, options) {
Console.prototype.dir = function dir(object, options) {
options = Object.assign({customInspect: false}, options);
this._stdout.write(`${util.inspect(object, options)}\n`);
};


Console.prototype.time = function(label) {
Console.prototype.time = function time(label) {
this._times.set(label, process.hrtime());
};


Console.prototype.timeEnd = function(label) {
Console.prototype.timeEnd = function timeEnd(label) {
const time = this._times.get(label);
if (!time) {
process.emitWarning(`No such label '${label}' for console.timeEnd()`);
Expand All @@ -90,7 +90,7 @@ Console.prototype.trace = function trace(...args) {
};


Console.prototype.assert = function(expression, ...args) {
Console.prototype.assert = function assert(expression, ...args) {
if (!expression) {
require('assert').ok(false, util.format.apply(null, args));
}
Expand Down

0 comments on commit bd7d7a7

Please sign in to comment.