Skip to content

Commit

Permalink
util: move util.isRegExp to eol
Browse files Browse the repository at this point in the history
PR-URL: nodejs#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 a59c7ae commit d3068b9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 41 deletions.
8 changes: 5 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,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 @@ -1268,9 +1271,9 @@ changes:
description: Documentation-only deprecation.
-->

Type: Runtime
Type: End-of-Life

The [`util.isRegExp()`][] API is deprecated. Please use
The `util.isRegExp()` API has been removed. Please use
`arg instanceof RegExp` instead.

### DEP0056: `util.isString()`
Expand Down Expand Up @@ -3804,7 +3807,6 @@ is deprecated to better align with recommendations per [NIST SP 800-38D][].
[`util.isFunction()`]: util.md#utilisfunctionobject
[`util.isObject()`]: util.md#utilisobjectobject
[`util.isPrimitive()`]: util.md#utilisprimitiveobject
[`util.isRegExp()`]: util.md#utilisregexpobject
[`util.log()`]: util.md#utillogstring
[`util.promisify`]: util.md#utilpromisifyoriginal
[`util.toUSVString()`]: util.md#utiltousvstringstring
Expand Down
25 changes: 0 additions & 25 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -3115,31 +3115,6 @@ util.isPrimitive(new Date());
// Returns: false
```
### `util.isRegExp(object)`
<!-- YAML
added: v0.6.0
deprecated: v4.0.0
-->
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}
Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.
```js
const util = require('node:util');

util.isRegExp(/some regexp/);
// Returns: true
util.isRegExp(new RegExp('another regexp'));
// Returns: true
util.isRegExp({});
// Returns: false
```
### `util.log(string)`
<!-- YAML
Expand Down
3 changes: 0 additions & 3 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,6 @@ module.exports = {
}
return internalDeepEqual(a, b);
},
isRegExp: deprecate(types.isRegExp,
'The `util.isRegExp` API is deprecated. Please use `arg instanceof RegExp` instead.',
'DEP0055'),
isObject: deprecate(isObject,
'The `util.isObject` API is deprecated. ' +
'Please use `arg !== null && typeof arg === "object"` instead.',
Expand Down
10 changes: 0 additions & 10 deletions test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ assert.strictEqual(util.isArray(/regexp/), false);
assert.strictEqual(util.isArray(new Error()), false);
assert.strictEqual(util.isArray({ __proto__: Array.prototype }), false);

// isRegExp
assert.strictEqual(util.isRegExp(/regexp/), true);
assert.strictEqual(util.isRegExp(RegExp(), 'foo'), true);
assert.strictEqual(util.isRegExp(new RegExp()), true);
assert.strictEqual(util.isRegExp(context('RegExp')()), true);
assert.strictEqual(util.isRegExp({}), false);
assert.strictEqual(util.isRegExp([]), false);
assert.strictEqual(util.isRegExp(new Date()), false);
assert.strictEqual(util.isRegExp({ __proto__: RegExp.prototype }), false);

// isDate
assert.strictEqual(util.isDate(new Date()), true);
assert.strictEqual(util.isDate(new Date(0), 'foo'), true);
Expand Down

0 comments on commit d3068b9

Please sign in to comment.