Skip to content

Commit

Permalink
util: move util.isString 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 708f57e commit 832a77c
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 @@ -1277,6 +1277,9 @@ The [`util.isRegExp()`][] API is deprecated. 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 @@ -1292,9 +1295,9 @@ changes:
description: Documentation-only deprecation.
-->

Type: Runtime
Type: End-of-Life

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

### DEP0057: `util.isSymbol()`
Expand Down Expand Up @@ -3796,7 +3799,6 @@ is deprecated to better align with recommendations per [NIST SP 800-38D][].
[`util.isObject()`]: util.md#utilisobjectobject
[`util.isPrimitive()`]: util.md#utilisprimitiveobject
[`util.isRegExp()`]: util.md#utilisregexpobject
[`util.isString()`]: util.md#utilisstringobject
[`util.isSymbol()`]: util.md#utilissymbolobject
[`util.isUndefined()`]: util.md#utilisundefinedobject
[`util.log()`]: util.md#utillogstring
Expand Down
27 changes: 0 additions & 27 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -3140,33 +3140,6 @@ util.isRegExp({});
// Returns: false
```
### `util.isString(object)`
<!-- YAML
added: v0.11.5
deprecated: v4.0.0
-->
> Stability: 0 - Deprecated: Use `typeof value === 'string'` instead.
* `object` {any}
* Returns: {boolean}
Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.
```js
const util = require('node:util');

util.isString('');
// Returns: true
util.isString('foo');
// Returns: true
util.isString(String('foo'));
// Returns: true
util.isString(5);
// Returns: false
```
### `util.isSymbol(object)`
<!-- YAML
Expand Down
11 changes: 0 additions & 11 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ function lazyAbortController() {

let internalDeepEqual;

/**
* @param {any} arg
* @returns {arg is string}
*/
function isString(arg) {
return typeof arg === 'string';
}

/**
* @deprecated since v4.0.0
* @param {any} arg
Expand Down Expand Up @@ -389,9 +381,6 @@ module.exports = {
}
return internalDeepEqual(a, b);
},
isString: deprecate(isString,
'The `util.isString` API is deprecated. Please use `typeof arg === "string"` instead.',
'DEP0056'),
isSymbol: deprecate(isSymbol,
'The `util.isSymbol` API is deprecated. Please use `arg === "symbol"` instead.',
'DEP0057'),
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 @@ -103,10 +103,6 @@ assert.strictEqual(util.isUndefined(), true);
assert.strictEqual(util.isUndefined(null), false);
assert.strictEqual(util.isUndefined('string'), false);

assert.strictEqual(util.isString('string'), true);
assert.strictEqual(util.isString(), false);
assert.strictEqual(util.isString(42), false);

assert.strictEqual(util.isSymbol(Symbol()), true);
assert.strictEqual(util.isSymbol(), false);
assert.strictEqual(util.isSymbol('string'), false);
Expand Down

0 comments on commit 832a77c

Please sign in to comment.