Skip to content

Commit

Permalink
util: move util.isBoolean 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 ac97a53 commit be528ab
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 45 deletions.
8 changes: 5 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,9 @@ instead.

<!-- 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 @@ -1011,9 +1014,9 @@ changes:
description: Documentation-only deprecation.
-->

Type: Runtime
Type: End-of-Life

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

### DEP0046: `util.isBuffer()`
Expand Down Expand Up @@ -3776,7 +3779,6 @@ is deprecated to better align with recommendations per [NIST SP 800-38D][].
[`util.inspect()`]: util.md#utilinspectobject-options
[`util.inspect.custom`]: util.md#utilinspectcustom
[`util.isArray()`]: util.md#utilisarrayobject
[`util.isBoolean()`]: util.md#utilisbooleanobject
[`util.isBuffer()`]: util.md#utilisbufferobject
[`util.isDate()`]: util.md#utilisdateobject
[`util.isError()`]: util.md#utiliserrorobject
Expand Down
25 changes: 0 additions & 25 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -2950,31 +2950,6 @@ util.isArray({});
// Returns: false
```
### `util.isBoolean(object)`
<!-- YAML
added: v0.11.5
deprecated: v4.0.0
-->
> Stability: 0 - Deprecated: Use `typeof value === 'boolean'` instead.
* `object` {any}
* Returns: {boolean}
Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
```js
const util = require('node:util');

util.isBoolean(1);
// Returns: false
util.isBoolean(0);
// Returns: false
util.isBoolean(false);
// Returns: true
```
### `util.isBuffer(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 @@ -91,15 +91,6 @@ function lazyAbortController() {

let internalDeepEqual;

/**
* @deprecated since v4.0.0
* @param {any} arg
* @returns {arg is boolean}
*/
function isBoolean(arg) {
return typeof arg === 'boolean';
}

/**
* @deprecated since v4.0.0
* @param {any} arg
Expand Down Expand Up @@ -419,9 +410,6 @@ module.exports = {
isArray: deprecate(ArrayIsArray,
'The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.',
'DEP0044'),
isBoolean: deprecate(isBoolean,
'The `util.isBoolean` API is deprecated. Please use `typeof arg === "boolean"` instead.',
'DEP0045'),
isBuffer: deprecate(isBuffer,
'The `util.isBuffer` API is deprecated. Please use `Buffer.isBuffer()` instead.',
'DEP0046'),
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 @@ -102,11 +102,6 @@ assert.strictEqual(util.isPrimitive(Symbol('symbol')), true);
assert.strictEqual(util.isBuffer('foo'), false);
assert.strictEqual(util.isBuffer(Buffer.from('foo')), true);

// deprecated
assert.strictEqual(util.isBoolean(true), true);
assert.strictEqual(util.isBoolean(false), true);
assert.strictEqual(util.isBoolean('string'), false);

assert.strictEqual(util.isNull(null), true);
assert.strictEqual(util.isNull(undefined), false);
assert.strictEqual(util.isNull(), false);
Expand Down

0 comments on commit be528ab

Please sign in to comment.