Primitives / foldkit-primitives/dom

applyMask

function · packages/primitives/src/dom/input-mask.ts:42

function applyMask(
  value: string,
  pattern: string,
): {
  readonly masked: string
  readonly raw: string
}

The mask as a pure function: # takes a digit, A a letter, * either, and any other character of the pattern is written in once input reaches past it. Input that fits no placeholder is skipped. masked is what the field shows; raw is only the characters typed.