diff options
Diffstat (limited to 'doc/api/util.md')
-rw-r--r-- | doc/api/util.md | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/doc/api/util.md b/doc/api/util.md index 8ed8c0b2c9a..529f7b6fc7e 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -20,10 +20,10 @@ added: v8.2.0 * `original` {Function} An `async` function * Returns: {Function} a callback style function -Takes an `async` function (or a function that returns a Promise) and returns a +Takes an `async` function (or a function that returns a `Promise`) and returns a function following the error-first callback style, i.e. taking -a `(err, value) => ...` callback as the last argument. In the callback, the -first argument will be the rejection reason (or `null` if the Promise +an `(err, value) => ...` callback as the last argument. In the callback, the +first argument will be the rejection reason (or `null` if the `Promise` resolved), and the second argument will be the resolved value. ```js @@ -185,7 +185,7 @@ added: v0.5.3 changes: - version: REPLACEME pr-url: https://github.com/nodejs/node/pull/17907 - description: The `%o` specifiers `depth` option is now set to Infinity. + description: The `%o` specifiers `depth` option is now set to `Infinity`. - version: v8.4.0 pr-url: https://github.com/nodejs/node/pull/14558 description: The `%o` and `%O` specifiers are supported now. @@ -200,18 +200,18 @@ The first argument is a string containing zero or more *placeholder* tokens. Each placeholder token is replaced with the converted value from the corresponding argument. Supported placeholders are: -* `%s` - String. -* `%d` - Number (integer or floating point value). +* `%s` - `String`. +* `%d` - `Number` (integer or floating point value). * `%i` - Integer. * `%f` - Floating point value. * `%j` - JSON. Replaced with the string `'[Circular]'` if the argument contains circular references. -* `%o` - Object. A string representation of an object +* `%o` - `Object`. A string representation of an object with generic JavaScript object formatting. Similar to `util.inspect()` with options `{ showHidden: true, showProxy: true }`. This will show the full object including non-enumerable properties and proxies. -* `%O` - Object. A string representation of an object with generic JavaScript +* `%O` - `Object`. A string representation of an object with generic JavaScript object formatting. Similar to `util.inspect()` without options. This will show the full object not including non-enumerable properties and proxies. * `%%` - single percent sign (`'%'`). This does not consume an argument. @@ -365,10 +365,11 @@ added: v0.3.0 changes: - version: v10.0.0 pr-url: https://github.com/nodejs/node/pull/19259 - description: WeakMap and WeakSet entries can now be inspected as well. + description: The `WeakMap` and `WeakSet` entries can now be inspected + as well. - version: REPLACEME pr-url: https://github.com/nodejs/node/pull/17907 - description: The `depth` default changed to Infinity. + description: The `depth` default changed to `Infinity`. - version: v9.9.0 pr-url: https://github.com/nodejs/node/pull/17576 description: The `compact` option is supported now. @@ -387,7 +388,7 @@ changes: description: The `showProxy` option is supported now. --> -* `object` {any} Any JavaScript primitive or Object. +* `object` {any} Any JavaScript primitive or `Object`. * `options` {Object} * `showHidden` {boolean} If `true`, the `object`'s non-enumerable symbols and properties will be included in the formatted result as well as [`WeakMap`][] @@ -418,10 +419,10 @@ changes: objects the same as arrays. Note that no text will be reduced below 16 characters, no matter the `breakLength` size. For more information, see the example below. **Default:** `true`. - * `depth` {number} Specifies the number visible nested Objects in an `object`. - This is useful to minimize the inspection output for large complicated - objects. To make it recurse indefinitely pass `null` or `Infinity`. - **Default:** `Infinity`. + * `depth` {number} Specifies the number of visible nested `Object`s in an + `object`. This is useful to minimize the inspection output for large + complicated objects. To make it recurse indefinitely pass `null` or + `Infinity`. **Default:** `Infinity`. * Returns: {string} The representation of passed object The `util.inspect()` method returns a string representation of `object` that is @@ -640,7 +641,7 @@ util.inspect(obj); added: v6.6.0 --> -A Symbol that can be used to declare custom inspect functions, see +* {symbol} that can be used to declare custom inspect functions, see [Custom inspection functions on Objects][]. ### util.inspect.defaultOptions @@ -687,7 +688,7 @@ added: v8.0.0 * Returns: {Function} Takes a function following the common error-first callback style, i.e. taking -a `(err, value) => ...` callback as the last argument, and returns a version +an `(err, value) => ...` callback as the last argument, and returns a version that returns promises. ```js @@ -767,9 +768,7 @@ throw an error. added: v8.0.0 --> -* {symbol} - -A Symbol that can be used to declare custom promisified variants of functions, +* {symbol} that can be used to declare custom promisified variants of functions, see [Custom promisified functions][]. ## Class: util.TextDecoder @@ -876,7 +875,7 @@ supported encodings or an alias. ### textDecoder.decode([input[, options]]) * `input` {ArrayBuffer|DataView|TypedArray} An `ArrayBuffer`, `DataView` or - Typed Array instance containing the encoded data. + `TypedArray` instance containing the encoded data. * `options` {Object} * `stream` {boolean} `true` if additional chunks of data are expected. **Default:** `false`. |