Skip to content

Commit

Permalink
util: move util.isBuffer 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 be528ab commit e32b0c1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 38 deletions.
9 changes: 5 additions & 4 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,9 @@ The `util.isBoolean()` 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 @@ -1038,9 +1041,9 @@ changes:
description: Documentation-only deprecation.
-->

Type: Runtime
Type: End-of-Life

The [`util.isBuffer()`][] API is deprecated. Please use
The `util.isBuffer()` API has been removed. Please use
[`Buffer.isBuffer()`][] instead.

### DEP0047: `util.isDate()`
Expand Down Expand Up @@ -3779,8 +3782,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.isBuffer()`]: util.md#utilisbufferobject
[`util.isDate()`]: util.md#utilisdateobject
[`util.isError()`]: util.md#utiliserrorobject
[`util.isFunction()`]: util.md#utilisfunctionobject
[`util.isNull()`]: util.md#utilisnullobject
Expand Down
26 changes: 0 additions & 26 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.isBuffer(object)`
<!-- YAML
added: v0.11.5
deprecated: v4.0.0
-->
> Stability: 0 - Deprecated: Use [`Buffer.isBuffer()`][] instead.
* `object` {any}
* Returns: {boolean}
Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.
```js
const util = require('node:util');

util.isBuffer({ length: 0 });
// Returns: false
util.isBuffer([]);
// Returns: false
util.isBuffer(Buffer.from('hello world'));
// Returns: true
```
### `util.isDate(object)`
<!-- YAML
Expand Down Expand Up @@ -3355,7 +3330,6 @@ util.log('Timestamped message.');
[`Array.isArray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
[`ArrayBuffer.isView()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
[`Buffer.isBuffer()`]: buffer.md#static-method-bufferisbufferobj
[`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
[`Date`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
[`Error`]: errors.md#class-error
Expand Down
4 changes: 0 additions & 4 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const {
validateString,
validateOneOf,
} = require('internal/validators');
const { isBuffer } = require('buffer').Buffer;
const types = require('internal/util/types');
const binding = internalBinding('util');

Expand Down Expand Up @@ -410,9 +409,6 @@ module.exports = {
isArray: deprecate(ArrayIsArray,
'The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.',
'DEP0044'),
isBuffer: deprecate(isBuffer,
'The `util.isBuffer` API is deprecated. Please use `Buffer.isBuffer()` instead.',
'DEP0046'),
isDeepStrictEqual(a, b) {
if (internalDeepEqual === undefined) {
internalDeepEqual = require('internal/util/comparisons')
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 @@ -98,10 +98,6 @@ assert.strictEqual(util.isPrimitive(Infinity), true);
assert.strictEqual(util.isPrimitive(NaN), true);
assert.strictEqual(util.isPrimitive(Symbol('symbol')), true);

// isBuffer
assert.strictEqual(util.isBuffer('foo'), false);
assert.strictEqual(util.isBuffer(Buffer.from('foo')), true);

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

0 comments on commit e32b0c1

Please sign in to comment.