GeezerVison is showing github.com — util: move util.isObject to eol · nodejs/node@bd559e3
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/deprecations.md +5-3Lines changed: 5 additions & 3 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1204,6 +1204,9 @@ The `util.isNumber()` API has been removed. Please use | 1204 | 1204 |
| 1205 | 1205 | <!-- YAML | 1206 | 1206 | changes: | | 1207 | + - version: REPLACEME | | 1208 | + pr-url: https://github.com/nodejs/node/pull/52744 | | 1209 | + description: End-of-Life deprecation. | 1207 | 1210 | - version: v22.0.0 | 1208 | 1211 | pr-url: https://github.com/nodejs/node/pull/50488 | 1209 | 1212 | description: Runtime deprecation. | @@ -1219,9 +1222,9 @@ changes: | 1219 | 1222 | description: Documentation-only deprecation. | 1220 | 1223 | --> | 1221 | 1224 |
| 1222 | | -Type: Runtime | | 1225 | +Type: End-of-Life | 1223 | 1226 |
| 1224 | | -The [`util.isObject()`][] API is deprecated. Please use | | 1227 | +The `util.isObject()` API has been removed. Please use | 1225 | 1228 | `arg && typeof arg === 'object'` instead. | 1226 | 1229 |
| 1227 | 1230 | ### DEP0054: `util.isPrimitive()` | @@ -3805,7 +3808,6 @@ is deprecated to better align with recommendations per [NIST SP 800-38D][]. | 3805 | 3808 | [`util.isArray()`]: util.md#utilisarrayobject | 3806 | 3809 | [`util.isError()`]: util.md#utiliserrorobject | 3807 | 3810 | [`util.isFunction()`]: util.md#utilisfunctionobject | 3808 | | -[`util.isObject()`]: util.md#utilisobjectobject | 3809 | 3811 | [`util.isPrimitive()`]: util.md#utilisprimitiveobject | 3810 | 3812 | [`util.log()`]: util.md#utillogstring | 3811 | 3813 | [`util.promisify`]: util.md#utilpromisifyoriginal | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/util.md -30Lines changed: 0 additions & 30 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3045,36 +3045,6 @@ util.isFunction(Bar); | 3045 | 3045 | // Returns: true | 3046 | 3046 | ``` | 3047 | 3047 |
| 3048 | | -### `util.isObject(object)` | 3049 | | -
| 3050 | | -<!-- YAML | 3051 | | -added: v0.11.5 | 3052 | | -deprecated: v4.0.0 | 3053 | | ---> | 3054 | | -
| 3055 | | -> Stability: 0 - Deprecated: | 3056 | | -> Use `value !== null && typeof value === 'object'` instead. | 3057 | | -
| 3058 | | -* `object` {any} | 3059 | | -* Returns: {boolean} | 3060 | | -
| 3061 | | -Returns `true` if the given `object` is strictly an `Object` **and** not a | 3062 | | -`Function` (even though functions are objects in JavaScript). | 3063 | | -Otherwise, returns `false`. | 3064 | | -
| 3065 | | -```js | 3066 | | -const util = require('node:util'); | 3067 | | - | 3068 | | -util.isObject(5); | 3069 | | -// Returns: false | 3070 | | -util.isObject(null); | 3071 | | -// Returns: false | 3072 | | -util.isObject({}); | 3073 | | -// Returns: true | 3074 | | -util.isObject(() => {}); | 3075 | | -// Returns: false | 3076 | | -``` | 3077 | | -
| 3078 | 3048 | ### `util.isPrimitive(object)` | 3079 | 3049 |
| 3080 | 3050 | <!-- YAML | |
Collapse file Copy file name to clipboardExpand all lines: lib/util.js -13Lines changed: 0 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -90,15 +90,6 @@ function lazyAbortController() { | 90 | 90 |
| 91 | 91 | let internalDeepEqual; | 92 | 92 |
| 93 | | -/** | 94 | | - * @deprecated since v4.0.0 | 95 | | - * @param {any} arg | 96 | | - * @returns {a is NonNullable<object>} | 97 | | - */ | 98 | | -function isObject(arg) { | 99 | | - return arg !== null && typeof arg === 'object'; | 100 | | -} | 101 | | - | 102 | 93 | /** | 103 | 94 | * @deprecated since v4.0.0 | 104 | 95 | * @param {any} e | @@ -363,10 +354,6 @@ module.exports = { | 363 | 354 | } | 364 | 355 | return internalDeepEqual(a, b); | 365 | 356 | }, | 366 | | - isObject: deprecate(isObject, | 367 | | - 'The `util.isObject` API is deprecated. ' + | 368 | | - 'Please use `arg !== null && typeof arg === "object"` instead.', | 369 | | - 'DEP0053'), | 370 | 357 | isDate: deprecate(types.isDate, | 371 | 358 | 'The `util.isDate` API is deprecated. Please use `arg instanceof Date` instead.', | 372 | 359 | 'DEP0047'), | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-util.js -7Lines changed: 0 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -62,13 +62,6 @@ assert.strictEqual(util.isError({ name: 'Error', message: '' }), false); | 62 | 62 | assert.strictEqual(util.isError([]), false); | 63 | 63 | assert.strictEqual(util.isError({ __proto__: Error.prototype }), true); | 64 | 64 |
| 65 | | -// isObject | 66 | | -assert.strictEqual(util.isObject({}), true); | 67 | | -assert.strictEqual(util.isObject([]), true); | 68 | | -assert.strictEqual(util.isObject(new Number(3)), true); | 69 | | -assert.strictEqual(util.isObject(Number(4)), false); | 70 | | -assert.strictEqual(util.isObject(1), false); | 71 | | - | 72 | 65 | // isPrimitive | 73 | 66 | assert.strictEqual(util.isPrimitive({}), false); | 74 | 67 | assert.strictEqual(util.isPrimitive(new Error()), false); | |
|