Skip to content

Commit

Permalink
doc: provide replacements for deprecated util methods
Browse files Browse the repository at this point in the history
PR-URL: nodejs#18415
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
  • Loading branch information
addaleax authored and MayaLekova committed May 8, 2018
1 parent d7722cb commit be7f4c8
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -940,12 +940,12 @@ added: v0.6.0
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated: Use [`Array.isArray()`][] instead.
* `object` {any}
* Returns: {boolean}

Internal alias for [`Array.isArray`][].
Alias for [`Array.isArray()`][].

Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`.

Expand All @@ -966,7 +966,7 @@ added: v0.11.5
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated: Use `typeof value === 'boolean'` instead.
* `object` {any}
* Returns: {boolean}
Expand Down Expand Up @@ -1078,7 +1078,7 @@ added: v0.11.5
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated: Use `typeof value === 'function'` instead.
* `object` {any}
* Returns: {boolean}
Expand Down Expand Up @@ -1106,7 +1106,7 @@ added: v0.11.5
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated: Use `value === null` instead.
* `object` {any}
* Returns: {boolean}
Expand All @@ -1131,7 +1131,8 @@ added: v0.11.5
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated: Use
> `value === undefined || value === null` instead.
* `object` {any}
* Returns: {boolean}
Expand All @@ -1156,7 +1157,7 @@ added: v0.11.5
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated: Use `typeof value === 'number'` instead.
* `object` {any}
* Returns: {boolean}
Expand All @@ -1182,13 +1183,15 @@ added: v0.11.5
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated:
> Use `value !== null && typeof value === 'object'` instead.
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is strictly an `Object` **and** not a
`Function`. Otherwise, returns `false`.
`Function` (even though functions are objects in JavaScript).
Otherwise, returns `false`.

```js
const util = require('util');
Expand All @@ -1209,7 +1212,9 @@ added: v0.11.5
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated: Use
> `(typeof value !== 'object' && typeof value !== 'function') || value === null`
> instead.
* `object` {any}
* Returns: {boolean}
Expand Down Expand Up @@ -1270,7 +1275,7 @@ added: v0.11.5
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated: Use `typeof value === 'string'` instead.
* `object` {any}
* Returns: {boolean}
Expand All @@ -1296,7 +1301,7 @@ added: v0.11.5
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated: Use `typeof value === 'symbol'` instead.
* `object` {any}
* Returns: {boolean}
Expand All @@ -1320,7 +1325,7 @@ added: v0.11.5
deprecated: v4.0.0
-->

> Stability: 0 - Deprecated
> Stability: 0 - Deprecated: Use `value === undefined` instead.
* `object` {any}
* Returns: {boolean}
Expand Down Expand Up @@ -1379,7 +1384,7 @@ deprecated: v0.11.3
Deprecated predecessor of `console.log`.

[`'uncaughtException'`]: process.html#process_event_uncaughtexception
[`Array.isArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
[`Array.isArray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
[`Error`]: errors.html#errors_class_error
[`Object.assign()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
Expand Down

0 comments on commit be7f4c8

Please sign in to comment.