Preview environment

function verifyString

export function verifyString(data: string, error?: typeof Error, errorMessage?: string, allowEmpty?: boolean): string;

Verifies the provided data is a string, otherwise throws provided error.

Parameters

data: string
The string resolvable to resolve
optional
error?: typeof Error
The Error constructor to instantiate. Defaults to Error
optional
errorMessage?: string
The error message to throw with. Defaults to "Expected string, got instead."
optional
allowEmpty?: boolean
Whether an empty string should be allowed