ViraStack
  • About
  • Support
HomeGet StartedExamples

Getting started

  • Introduction
  • llms.txt
  • llms-full.txt

Usage

  • useViraMask()
  • Custom mask
  • Validation
  • Helpers
  • Types
  • UI libraries

Helpers

Formatting and utility functions you can use without the hook.

Mask helpers

FunctionDescription
applyMask(value, mask)Applies a pattern to a raw value
unmask(value, mask)Extracts data characters from a masked value
stripMask(value, mask)At a locked mask step, keeps only data slots
cleanValue(value, allowed?, forbidden?)Filters with allow / forbid regex

Currency

  • formatCurrency(value, options): raw "1234.56" → display (1,234.56 US default; customize separators for TR)
  • unformatCurrency(value, options): display → raw

Card

getCardType(cardNumber) → "visa" | "mastercard" | "amex" | "troy" | "unknown". Works from BIN prefixes (Visa 4, Amex 34/37, Troy 9792…).

Refs

mergeRefs(...refs): merge the RHF register ref with a local ref. The hook uses this internally; useful on your own controlled inputs too.

PreviousValidationNextTypes

On this page

  • Mask helpers
  • Currency
  • Card
  • Refs
Something wrong? Fix it