apps-script-utils 2.1.1 Help

nonValidLocale

function nonValidLocale(value: string): boolean;

nonValidLocale(value) is the same test as !isValidLocale(value), written so that a guard clause reads as a sentence rather than as a negation.

Exactly two ASCII letters, in either case — "en", "UK". A region or a script subtag, as in "en-US", is rejected: this is the short language code, not a full BCP 47 tag.

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

value

string

The value to check.

Returns

boolean — true when the value is not a locale code; otherwise false.

Examples

What passes and what does not

nonValidLocale("en-US"); // => true nonValidLocale("eng"); // => true nonValidLocale(""); // => true nonValidLocale("en"); // => false nonValidLocale("UK"); // => false

See also

Source

src/lang/string/nonValidLocale.ts

23 September 2026

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