Skip to content

Commit

Permalink
util: move util.isNumber to eol
Browse files Browse the repository at this point in the history
PR-URL: #52744
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
marco-ippolito authored and nodejs-github-bot committed May 6, 2024
1 parent 6ec403f commit 708f57e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 46 deletions.
8 changes: 5 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,9 @@ The `util.isNullOrUndefined()` 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 @@ -1192,9 +1195,9 @@ changes:
description: Documentation-only deprecation.
-->

Type: Runtime
Type: End-of-Life

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

### DEP0053: `util.isObject()`
Expand Down Expand Up @@ -3790,7 +3793,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.isNumber()`]: util.md#utilisnumberobject
[`util.isObject()`]: util.md#utilisobjectobject
[`util.isPrimitive()`]: util.md#utilisprimitiveobject
[`util.isRegExp()`]: util.md#utilisregexpobject
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.isNumber(object)`
<!-- YAML
added: v0.11.5
deprecated: v4.0.0
-->
> Stability: 0 - Deprecated: Use `typeof value === 'number'` instead.
* `object` {any}
* Returns: {boolean}
Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
```js
const util = require('node:util');

util.isNumber(false);
// Returns: false
util.isNumber(Infinity);
// Returns: true
util.isNumber(0);
// Returns: true
util.isNumber(NaN);
// Returns: true
```
### `util.isObject(object)`
<!-- YAML
Expand Down
12 changes: 0 additions & 12 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 number}
*/
function isNumber(arg) {
return typeof arg === 'number';
}

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

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

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

0 comments on commit 708f57e

Please sign in to comment.