util: rename util.inspect argument

util.inspect can actually receive any property and the description
was wrong so far. This fixes it by renaming the argument to
value and also updating the description.

PR-URL: https://github.com/nodejs/node/pull/17576
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Ruben Bridgewater 2017-12-09 05:33:00 -02:00
parent c2203cb4dd
commit 353cc3d35a
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -263,14 +263,14 @@ function debuglog(set) {
}
/**
* Echos the value of a value. Tries to print the value out
* Echos the value of any input. Tries to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {any} value The value to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* Legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
/* Legacy: value, showHidden, depth, colors*/
function inspect(value, opts) {
// Default options
const ctx = {
seen: [],
@ -305,7 +305,7 @@ function inspect(obj, opts) {
}
if (ctx.colors) ctx.stylize = stylizeWithColor;
if (ctx.maxArrayLength === null) ctx.maxArrayLength = Infinity;
return formatValue(ctx, obj, ctx.depth);
return formatValue(ctx, value, ctx.depth);
}
inspect.custom = customInspectSymbol;