Skip to main content
Version: 11.14.0

isString

Deprecated

Use typeof value === "string" directly instead.

Checks whether the given value is a string.

Parameters

ParameterTypeRequiredDescription
valueunknownThe value to check

Returns booleantrue if the value is a string, false otherwise.

Example

is-string.ts
import { isString } from '@sinequa/atomic';

console.log(isString('hello')); // true
console.log(isString(42)); // false

// Preferred alternative:
console.log(typeof 'hello' === 'string'); // true