Skip to main content
Module

x/iso639_1/mod.ts>parseLanguageCode

Type-safe ISO 639-1 language code (a.k.a. two-letter codes) for TypeScript
Latest
function parseLanguageCode
import { parseLanguageCode } from "https://deno.land/x/iso639_1@1.2.20090901/mod.ts";

Parses the given string as a language code. If the given string is not a valid language code, null is returned.

Parameters

code: string | null | undefined

The string expected to be a language code. Case is ignored. If the given string is null or undefined, null is returned.

optional
options: Partial<ParseLanguageCodeOptions>

Options to control the parsing behavior. See also the ParseLanguageCodeOptions type.

Returns

The language code if the given string is a valid language code, null otherwise.