fn

maskTransform

v0.0.14tested

Pure, DOM-free masking: conform a string (or ElementState) through the full preprocessor → mask → postprocessor pipeline. Ideal for SSR, server-side validation, and tests. Returns a string for string input and an ElementState for state input.

Example

ts
maskTransform('1234567890', maskPhoneOptions({ template: '+1 (###) ###-####' }));
// '+1 (123) 456-7890'

Signatures

ts
export function maskTransform(value: string, options: MaskOptions): string;
ts
export function maskTransform(state: ElementState, options: MaskOptions): ElementState;

Parameters

ParameterTypeDescription
valueOrStatestring | ElementState
optionsMaskOptions

Returns

string | ElementState