-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathtypes.d.ts
More file actions
30 lines (26 loc) · 726 Bytes
/
types.d.ts
File metadata and controls
30 lines (26 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
interface BaseCard {
luhn: boolean;
digits: number | number[];
cvcLength: number;
groupPattern: RegExp;
group(number: string): string[];
test(number: string, eager: boolean): boolean;
}
interface CardData {
name: string;
pattern: RegExp;
eagerPattern: RegExp;
}
export type CardType = BaseCard & CardData;
interface ICardTypes {
find: (
callback: (element: CardType, index: number, array: CardType[]) => void
) => CardType | undefined;
some: (
callback: (element: CardType, index: number, array: CardType[]) => void
) => boolean;
get: (name: string) => CardType;
}
declare const CardTypes: (types: CardType[]) => ICardTypes;
export default CardTypes;
export const defaults: CardType[];