1 import type { FactoryOpts } from 'imask';
2 import MaskedRange from 'imask/esm/masked/range';
4 export const cardNumberMask = (value: string): FactoryOpts => {
5 switch (Number(value.slice(0, 2))) {
9 return { mask: '0000 000000 00000' };
11 return { mask: '0000 0000 0000 0000 000' };
15 export const cardNumberHiddenValue = (value: string): string => {
19 if (value.length < 12) {
20 return '•••• •••• •••• ••••';
23 const firstFour = value.slice(0, 4);
24 const lastFour = value.slice(-4);
26 switch (Number(value.slice(0, 2))) {
29 return `${firstFour} •••••• •${lastFour}`;
31 return `${firstFour} •••• •••• ${lastFour}`;
35 export const expDateMask = {