util: move util.isFunction to eol

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
marco-ippolito 2024-04-29 11:27:11 +02:00 committed by Node.js GitHub Bot
parent dc379626ab
commit 72240942ed
4 changed files with 5 additions and 48 deletions

View File

@ -1105,6 +1105,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.
@ -1120,9 +1123,9 @@ changes:
description: Documentation-only deprecation.
-->
Type: Runtime
Type: End-of-Life
The [`util.isFunction()`][] API is deprecated. Please use
The `util.isFunction()` API has been removed. Please use
`typeof arg === 'function'` instead.
### DEP0050: `util.isNull()`

View File

@ -2950,35 +2950,6 @@ util.isArray({});
// Returns: false
```
### `util.isFunction(object)`
<!-- YAML
added: v0.11.5
deprecated: v4.0.0
-->
> Stability: 0 - Deprecated: Use `typeof value === 'function'` instead.
* `object` {any}
* Returns: {boolean}
Returns `true` if the given `object` is a `Function`. Otherwise, returns
`false`.
```js
const util = require('node:util');
function Foo() {}
const Bar = () => {};
util.isFunction({});
// Returns: false
util.isFunction(Foo);
// Returns: true
util.isFunction(Bar);
// Returns: true
```
### `util.isPrimitive(object)`
<!-- YAML

View File

@ -89,15 +89,6 @@ function lazyAbortController() {
let internalDeepEqual;
/**
* @deprecated since v4.0.0
* @param {any} arg
* @returns {arg is Function}
*/
function isFunction(arg) {
return typeof arg === 'function';
}
/**
* @deprecated since v4.0.0
* @param {any} arg
@ -344,9 +335,6 @@ module.exports = {
}
return internalDeepEqual(a, b);
},
isFunction: deprecate(isFunction,
'The `util.isFunction` API is deprecated. Please use `typeof arg === "function"` instead.',
'DEP0049'),
isPrimitive: deprecate(isPrimitive,
'The `util.isPrimitive` API is deprecated. ' +
'Please use `arg === null || ' +

View File

@ -57,11 +57,6 @@ assert.strictEqual(util.isPrimitive(Infinity), true);
assert.strictEqual(util.isPrimitive(NaN), true);
assert.strictEqual(util.isPrimitive(Symbol('symbol')), true);
assert.strictEqual(util.isFunction(() => {}), true);
assert.strictEqual(util.isFunction(function() {}), true);
assert.strictEqual(util.isFunction(), false);
assert.strictEqual(util.isFunction('string'), false);
assert.strictEqual(util.toUSVString('string\ud801'), 'string\ufffd');
{