Skip to content

Commit

Permalink
util: move util.isFunction to eol
Browse files Browse the repository at this point in the history
PR-URL: #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 dc37962 commit 7224094
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 48 deletions.
7 changes: 5 additions & 2 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()`
Expand Down
29 changes: 0 additions & 29 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 || ' +
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 @@ -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');

{
Expand Down

0 comments on commit 7224094

Please sign in to comment.