diff options
author | Jackson Tian <shyvo1987@gmail.com> | 2016-02-14 15:32:33 +0800 |
---|---|---|
committer | Michaël Zasso <mic.besace@gmail.com> | 2016-02-18 11:24:01 +0100 |
commit | 0903b6d8a8b63075ff7f2efae8a1922542439728 (patch) | |
tree | ce5d8cdf95c0c053f1e5fada459dd2a4417db23b /lib/console.js | |
parent | 0cb0287f8a50633c23aa38f72aace5c864f7dfd2 (diff) | |
download | android-node-v8-0903b6d8a8b63075ff7f2efae8a1922542439728.tar.gz android-node-v8-0903b6d8a8b63075ff7f2efae8a1922542439728.tar.bz2 android-node-v8-0903b6d8a8b63075ff7f2efae8a1922542439728.zip |
console: apply null as `this` for util.format
Util.format is just a stateless function. Apply current console
as `this` is unnecessary.
PR-URL: https://github.com/nodejs/node/pull/5222
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Diffstat (limited to 'lib/console.js')
-rw-r--r-- | lib/console.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/console.js b/lib/console.js index a0eec4e348..21b2d01de0 100644 --- a/lib/console.js +++ b/lib/console.js @@ -33,7 +33,7 @@ function Console(stdout, stderr) { } Console.prototype.log = function() { - this._stdout.write(util.format.apply(this, arguments) + '\n'); + this._stdout.write(util.format.apply(null, arguments) + '\n'); }; @@ -41,7 +41,7 @@ Console.prototype.info = Console.prototype.log; Console.prototype.warn = function() { - this._stderr.write(util.format.apply(this, arguments) + '\n'); + this._stderr.write(util.format.apply(null, arguments) + '\n'); }; @@ -77,7 +77,7 @@ Console.prototype.trace = function trace() { // exposed. var err = new Error(); err.name = 'Trace'; - err.message = util.format.apply(this, arguments); + err.message = util.format.apply(null, arguments); Error.captureStackTrace(err, trace); this.error(err.stack); }; @@ -86,7 +86,7 @@ Console.prototype.trace = function trace() { Console.prototype.assert = function(expression) { if (!expression) { var arr = Array.prototype.slice.call(arguments, 1); - require('assert').ok(false, util.format.apply(this, arr)); + require('assert').ok(false, util.format.apply(null, arr)); } }; |