Skip to main content
Version: Next 🚧

isString

Deprecated

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

Checks whether the given value is a string.

Parameters

ParameterTypeRequiredDescription
valueunknown✓The value to check

Returns boolean — true 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