Skip to content

masks

const masks: {
creditCard: (newValue, oldValue) => string | false | void;
dateEU: (newValue, oldValue) => string | false | void;
dateISO: (newValue, oldValue) => string | false | void;
dateUS: (newValue, oldValue) => string | false | void;
intlPhone: (newValue, oldValue) => string | false | void;
ipv4: (newValue, oldValue) => string | false | void;
mac: (newValue, oldValue) => string | false | void;
ssn: (newValue, oldValue) => string | false | void;
time: (newValue, oldValue) => string | false | void;
timeFull: (newValue, oldValue) => string | false | void;
usPhone: (newValue, oldValue) => string | false | void;
zip: (newValue, oldValue) => string | false | void;
zipPlus4: (newValue, oldValue) => string | false | void;
};

Pre-built mask patterns for common use cases.

NameTypeDescription
creditCard()(newValue, oldValue) => string | false | voidCredit Card: 1234 5678 9012 3456
dateEU()(newValue, oldValue) => string | false | voidDate DD/MM/YYYY
dateISO()(newValue, oldValue) => string | false | voidDate YYYY-MM-DD
dateUS()(newValue, oldValue) => string | false | voidDate MM/DD/YYYY
intlPhone()(newValue, oldValue) => string | false | voidInternational Phone: +1 234 567 8900
ipv4()(newValue, oldValue) => string | false | voidIPv4: 192.168.001.001
mac()(newValue, oldValue) => string | false | voidMAC Address: AA:BB:CC:DD:EE:FF
ssn()(newValue, oldValue) => string | false | voidSSN: 123-45-6789
time()(newValue, oldValue) => string | false | voidTime HH:MM
timeFull()(newValue, oldValue) => string | false | voidTime HH:MM:SS
usPhone()(newValue, oldValue) => string | false | voidUS Phone: (123) 456-7890
zip()(newValue, oldValue) => string | false | voidZIP Code: 12345
zipPlus4()(newValue, oldValue) => string | false | voidZIP+4: 12345-6789