Skip to content

Commit

Permalink
util: move util.isNullOrUndefined 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 7cd8bb2 commit 6ec403f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 48 deletions.
8 changes: 5 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,9 @@ The `util.isNull()` 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 @@ -1165,9 +1168,9 @@ changes:
description: Documentation-only deprecation.
-->

Type: Runtime
Type: End-of-Life

The [`util.isNullOrUndefined()`][] API is deprecated. Please use
The `util.isNullOrUndefined()` API has been removed. Please use
`arg === null || arg === undefined` instead.

### DEP0052: `util.isNumber()`
Expand Down Expand Up @@ -3787,7 +3790,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.isNullOrUndefined()`]: util.md#utilisnullorundefinedobject
[`util.isNumber()`]: util.md#utilisnumberobject
[`util.isObject()`]: util.md#utilisobjectobject
[`util.isPrimitive()`]: util.md#utilisprimitiveobject
Expand Down
27 changes: 0 additions & 27 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -3045,33 +3045,6 @@ util.isFunction(Bar);
// Returns: true
```
### `util.isNullOrUndefined(object)`
<!-- YAML
added: v0.11.5
deprecated: v4.0.0
-->
> Stability: 0 - Deprecated: Use
> `value === undefined || value === null` instead.
* `object` {any}
* Returns: {boolean}
Returns `true` if the given `object` is `null` or `undefined`. Otherwise,
returns `false`.
```js
const util = require('node:util');

util.isNullOrUndefined(0);
// Returns: false
util.isNullOrUndefined(undefined);
// Returns: true
util.isNullOrUndefined(null);
// Returns: true
```
### `util.isNumber(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 {arg is (null | undefined)}
*/
function isNullOrUndefined(arg) {
return arg === null || arg === undefined;
}

/**
* @deprecated since v4.0.0
* @param {any} arg
Expand Down Expand Up @@ -407,10 +398,6 @@ module.exports = {
}
return internalDeepEqual(a, b);
},
isNullOrUndefined: deprecate(isNullOrUndefined,
'The `util.isNullOrUndefined` API is deprecated. ' +
'Please use `arg === null || arg === undefined` instead.',
'DEP0051'),
isNumber: deprecate(isNumber,
'The `util.isNumber` API is deprecated. Please use `typeof arg === "number"` instead.',
'DEP0052'),
Expand Down
5 changes: 0 additions & 5 deletions test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ assert.strictEqual(util.isUndefined(), true);
assert.strictEqual(util.isUndefined(null), false);
assert.strictEqual(util.isUndefined('string'), false);

assert.strictEqual(util.isNullOrUndefined(null), true);
assert.strictEqual(util.isNullOrUndefined(undefined), true);
assert.strictEqual(util.isNullOrUndefined(), true);
assert.strictEqual(util.isNullOrUndefined('string'), false);

assert.strictEqual(util.isNumber(42), true);
assert.strictEqual(util.isNumber(), false);
assert.strictEqual(util.isNumber('string'), false);
Expand Down

0 comments on commit 6ec403f

Please sign in to comment.