Skip to content

Commit

Permalink
util: move util.isObject to eol
Browse files Browse the repository at this point in the history
PR-URL: nodejs#52744
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
marco-ippolito authored and nodejs-github-bot committed May 6, 2024
1 parent d3068b9 commit bd559e3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 53 deletions.
8 changes: 5 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,9 @@ The `util.isNumber()` API has been removed. Please use

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/52744
description: End-of-Life deprecation.
- version: v22.0.0
pr-url: https://github.com/nodejs/node/pull/50488
description: Runtime deprecation.
Expand All @@ -1219,9 +1222,9 @@ changes:
description: Documentation-only deprecation.
-->

Type: Runtime
Type: End-of-Life

The [`util.isObject()`][] API is deprecated. Please use
The `util.isObject()` API has been removed. Please use
`arg && typeof arg === 'object'` instead.

### DEP0054: `util.isPrimitive()`
Expand Down Expand Up @@ -3805,7 +3808,6 @@ is deprecated to better align with recommendations per [NIST SP 800-38D][].
[`util.isArray()`]: util.md#utilisarrayobject
[`util.isError()`]: util.md#utiliserrorobject
[`util.isFunction()`]: util.md#utilisfunctionobject
[`util.isObject()`]: util.md#utilisobjectobject
[`util.isPrimitive()`]: util.md#utilisprimitiveobject
[`util.log()`]: util.md#utillogstring
[`util.promisify`]: util.md#utilpromisifyoriginal
Expand Down
30 changes: 0 additions & 30 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -3045,36 +3045,6 @@ util.isFunction(Bar);
// Returns: true
```
### `util.isObject(object)`
<!-- YAML
added: v0.11.5
deprecated: v4.0.0
-->
> 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` (even though functions are objects in JavaScript).
Otherwise, returns `false`.
```js
const util = require('node:util');

util.isObject(5);
// Returns: false
util.isObject(null);
// Returns: false
util.isObject({});
// Returns: true
util.isObject(() => {});
// Returns: false
```
### `util.isPrimitive(object)`
<!-- YAML
Expand Down
13 changes: 0 additions & 13 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ function lazyAbortController() {

let internalDeepEqual;

/**
* @deprecated since v4.0.0
* @param {any} arg
* @returns {a is NonNullable<object>}
*/
function isObject(arg) {
return arg !== null && typeof arg === 'object';
}

/**
* @deprecated since v4.0.0
* @param {any} e
Expand Down Expand Up @@ -363,10 +354,6 @@ module.exports = {
}
return internalDeepEqual(a, b);
},
isObject: deprecate(isObject,
'The `util.isObject` API is deprecated. ' +
'Please use `arg !== null && typeof arg === "object"` instead.',
'DEP0053'),
isDate: deprecate(types.isDate,
'The `util.isDate` API is deprecated. Please use `arg instanceof Date` instead.',
'DEP0047'),
Expand Down
7 changes: 0 additions & 7 deletions test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@ assert.strictEqual(util.isError({ name: 'Error', message: '' }), false);
assert.strictEqual(util.isError([]), false);
assert.strictEqual(util.isError({ __proto__: Error.prototype }), true);

// isObject
assert.strictEqual(util.isObject({}), true);
assert.strictEqual(util.isObject([]), true);
assert.strictEqual(util.isObject(new Number(3)), true);
assert.strictEqual(util.isObject(Number(4)), false);
assert.strictEqual(util.isObject(1), false);

// isPrimitive
assert.strictEqual(util.isPrimitive({}), false);
assert.strictEqual(util.isPrimitive(new Error()), false);
Expand Down

0 comments on commit bd559e3

Please sign in to comment.