apps-script-utils 2.1.1 Help

requireNonEmptyString

function requireNonEmptyString(value: string | null | undefined, message?: string): string;

Whitespace does not count as content: a string of spaces fails the check just as an empty one does. This is the guard most of the string helpers in this library open with.

Parameters

Parameter

Type

Description

value

string \| null \| undefined

The value to validate.

message (optional)

string

The message of the exception. A default is used when omitted.

Returns

string — the same string.

Throws

Exception

Condition

EmptyStringException

the value is not a string, or holds nothing but whitespace.

Examples

In use

requireNonEmptyString("Data"); // => "Data" requireNonEmptyString(" "); // throws EmptyStringException

See also

Source

src/lang/string/requireNonEmptyString.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.