Skip to main content
isString - util - Node documentation
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

Parameters

object: unknown

Return Type

object is string