nonValidSlug
function nonValidSlug(value: string): boolean;
nonValidSlug(value) is the same test as !isValidSlug(value), written so that a guard clause reads as a sentence rather than as a negation.
Starts with a letter, then letters, digits, hyphens and underscores — the shape a URL segment or a key can take. Spaces, leading digits and an empty string are rejected.
isX and nonX answer a question and never interrupt control flow; requireX and requireNonX hand the value back or throw. The scheme is explained in Validation conventions.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The value to check. |
Returns
boolean — true when the value is not a slug; otherwise false.
Examples
What passes and what does not
nonValidSlug("1-page"); // => true
nonValidSlug("my page"); // => true
nonValidSlug(""); // => true
nonValidSlug("my-page"); // => false
nonValidSlug("a_1"); // => false
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.