function isString
Usage in Deno
import { isString } from "node:util";
isString(object: unknown): object is string
Deprecated
Since v4.0.0 - Use typeof value === 'string'
instead.
Returns true
if the given object
is a string
. Otherwise, returns false
.
import util from 'node:util';
util.isString('');
// Returns: true
util.isString('foo');
// Returns: true
util.isString(String('foo'));
// Returns: true
util.isString(5);
// Returns: false
object is string