fn

maskCardOptions

v0.0.14

A dynamic payment-card mask that groups digits by the detected brand. The mask is a function of state: it reads the digits, resolves the brand via findCardBrand (by IIN/BIN prefix), and applies that brand's grouping template (e.g. #### ###### ##### for Amex) — falling back to a generic 16-digit grouping until a brand is recognized. The unmasked value is the digit string.

Example

ts
const card = useMaskedInput({ mask: maskCardOptions() });
// <input v-bind="card.bind">  — 4111… → '4111 1111 1111 1111', 3714… → Amex 4-6-5

Signature

ts
export function maskCardOptions(params: MaskCardParams ={ ... }

Parameters

ParameterTypeDescription
params?MaskCardParamsBrands and fallback template

Returns

MaskOptionsReady-to-use mask options (a function mask)
PropertyTypeDescription
maskMaskThe mask pattern (or a function of state).
preprocessors?readonly MaskPreprocessor[]Normalizers run before conforming.
postprocessors?readonly MaskPostprocessor[]Finishers run after conforming.
overwriteMode?OverwriteModeInsert vs overwrite behavior.