applyMask

Mask
stable

Apply a character-based mask pattern to a raw string value. Returns both the masked display string and the unmasked raw string, plus a flag indicating whether all consumer slots are filled.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

value
requis
string
The raw input string to format. Leading/trailing whitespace is preserved.
pattern
requis
string
The mask pattern string. Literal characters are emitted as-is; token characters consume one character from the input.

API

Valeur de retour

La valeur retournée par cet util.

An object { masked: string, unmasked: string, complete: boolean }. "complete" is true when every consumer token in the pattern has been filled.

Usage

Exemples

Extraits de code prêts à coller.

Phone number mask

typescript