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 |
|---|---|---|
|
| The value to validate. |
|
| The message of the exception. A default is used when omitted. |
Returns
string — the same string.
Throws
Exception | Condition |
|---|---|
| the value is not a string, or holds nothing but whitespace. |
Examples
In use
requireNonEmptyString("Data"); // => "Data"
requireNonEmptyString(" "); // throws EmptyStringException
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.