Skip to content

Commit bd6e0be

Browse files
committed
doc: provide replacements for deprecated util methods
PR-URL: #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>
1 parent 29697ef commit bd6e0be

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

doc/api/util.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -940,12 +940,12 @@ added: v0.6.0
940940
deprecated: v4.0.0
941941
-->
942942

943-
> Stability: 0 - Deprecated
943+
> Stability: 0 - Deprecated: Use [`Array.isArray()`][] instead.
944944
945945
* `object` {any}
946946
* Returns: {boolean}
947947

948-
Internal alias for [`Array.isArray`][].
948+
Alias for [`Array.isArray()`][].
949949

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

@@ -966,7 +966,7 @@ added: v0.11.5
966966
deprecated: v4.0.0
967967
-->
968968

969-
> Stability: 0 - Deprecated
969+
> Stability: 0 - Deprecated: Use `typeof value === 'boolean'` instead.
970970
971971
* `object` {any}
972972
* Returns: {boolean}
@@ -1078,7 +1078,7 @@ added: v0.11.5
10781078
deprecated: v4.0.0
10791079
-->
10801080

1081-
> Stability: 0 - Deprecated
1081+
> Stability: 0 - Deprecated: Use `typeof value === 'function'` instead.
10821082
10831083
* `object` {any}
10841084
* Returns: {boolean}
@@ -1106,7 +1106,7 @@ added: v0.11.5
11061106
deprecated: v4.0.0
11071107
-->
11081108

1109-
> Stability: 0 - Deprecated
1109+
> Stability: 0 - Deprecated: Use `value === null` instead.
11101110
11111111
* `object` {any}
11121112
* Returns: {boolean}
@@ -1131,7 +1131,8 @@ added: v0.11.5
11311131
deprecated: v4.0.0
11321132
-->
11331133

1134-
> Stability: 0 - Deprecated
1134+
> Stability: 0 - Deprecated: Use
1135+
> `value === undefined || value === null` instead.
11351136
11361137
* `object` {any}
11371138
* Returns: {boolean}
@@ -1156,7 +1157,7 @@ added: v0.11.5
11561157
deprecated: v4.0.0
11571158
-->
11581159

1159-
> Stability: 0 - Deprecated
1160+
> Stability: 0 - Deprecated: Use `typeof value === 'number'` instead.
11601161
11611162
* `object` {any}
11621163
* Returns: {boolean}
@@ -1182,13 +1183,15 @@ added: v0.11.5
11821183
deprecated: v4.0.0
11831184
-->
11841185

1185-
> Stability: 0 - Deprecated
1186+
> Stability: 0 - Deprecated:
1187+
> Use `value !== null && typeof value === 'object'` instead.
11861188
11871189
* `object` {any}
11881190
* Returns: {boolean}
11891191

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

11931196
```js
11941197
const util = require('util');
@@ -1209,7 +1212,9 @@ added: v0.11.5
12091212
deprecated: v4.0.0
12101213
-->
12111214

1212-
> Stability: 0 - Deprecated
1215+
> Stability: 0 - Deprecated: Use
1216+
> `(typeof value !== 'object' && typeof value !== 'function') || value === null`
1217+
> instead.
12131218
12141219
* `object` {any}
12151220
* Returns: {boolean}
@@ -1270,7 +1275,7 @@ added: v0.11.5
12701275
deprecated: v4.0.0
12711276
-->
12721277

1273-
> Stability: 0 - Deprecated
1278+
> Stability: 0 - Deprecated: Use `typeof value === 'string'` instead.
12741279
12751280
* `object` {any}
12761281
* Returns: {boolean}
@@ -1296,7 +1301,7 @@ added: v0.11.5
12961301
deprecated: v4.0.0
12971302
-->
12981303

1299-
> Stability: 0 - Deprecated
1304+
> Stability: 0 - Deprecated: Use `typeof value === 'symbol'` instead.
13001305
13011306
* `object` {any}
13021307
* Returns: {boolean}
@@ -1320,7 +1325,7 @@ added: v0.11.5
13201325
deprecated: v4.0.0
13211326
-->
13221327

1323-
> Stability: 0 - Deprecated
1328+
> Stability: 0 - Deprecated: Use `value === undefined` instead.
13241329
13251330
* `object` {any}
13261331
* Returns: {boolean}
@@ -1379,7 +1384,7 @@ deprecated: v0.11.3
13791384
Deprecated predecessor of `console.log`.
13801385

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

0 commit comments

Comments
 (0)