-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.test-d.ts
35 lines (22 loc) · 1.08 KB
/
index.test-d.ts
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
31
32
33
34
35
import {expectType} from 'tsd';
import {card, cvc, expiration} from '.';
expectType<string>(card.parse('4242424242424242'))
expectType<string>(card.format('4242424242424242'))
expectType<string>(card.format('4242424242424242', '-'))
expectType<string | undefined>(card.type('4242424242424242'))
expectType<boolean>(card.luhn('4242424242424242'))
expectType<boolean>(card.isValid('4242424242424242'))
expectType<boolean>(card.isValid('4242424242424242', 'Visa'))
expectType<boolean>(cvc.isValid('123'))
expectType<boolean>(cvc.isValid('123', 'Visa'))
expectType<boolean>(expiration.isPast(0, 2021))
expectType<boolean>(expiration.month.isValid(0))
expectType<number>(expiration.month.parse(1))
expectType<number>(expiration.month.parse('1'))
expectType<boolean>(expiration.year.isPast(2020))
expectType<boolean>(expiration.year.isValid(2020))
expectType<number>(expiration.year.parse(2020))
expectType<number>(expiration.year.parse(20, true))
expectType<number>(expiration.year.parse('2020'))
expectType<string>(expiration.year.format(2020))
expectType<string>(expiration.year.format(2020, true))