verifyString

export function verifyString(data: string, error?: typeof Error, errorMessage?: string, allowEmpty?: boolean): string;
export function verifyString(data: string, error?: typeof Error, errorMessage?: string, allowEmpty?: boolean): string;
Verifies the provided data is a string, otherwise throws provided error.
NameTypeOptionalDescription
datastringNoThe string resolvable to resolve
errortypeof ErrorYesThe Error constructor to instantiate. Defaults to Error
errorMessagestringYesThe error message to throw with. Defaults to "Expected string, got instead."
allowEmptybooleanYesWhether an empty string should be allowed