1 | "use strict";
|
2 |
|
3 | const iftype = require('iftype');
|
4 |
|
5 | function CustomType(){
|
6 | }
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | iftype(123).is('string');
|
12 | iftype(function foo(){}).is('string');
|
13 | iftype(new CustomType()).is('string');
|
14 | iftype(["foo", "bar"]).is('string');
|
15 | iftype("bar").is('string');
|
16 | iftype(null).is('string');
|
17 | iftype(undefined).is('string');
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | iftype(123).is('number');
|
24 | iftype(function foo(){}).is('number');
|
25 | iftype(new CustomType()).is('number');
|
26 | iftype(["foo", "bar"]).is('number');
|
27 | iftype("bar").is('number');
|
28 | iftype(null).is('number');
|
29 | iftype(undefined).is('number');
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | iftype(123).is('object');
|
36 | iftype(function foo(){}).is('object');
|
37 | iftype(new CustomType()).is('object');
|
38 | iftype(["foo", "bar"]).is('object');
|
39 | iftype("bar").is('object');
|
40 | iftype(null).is('object');
|
41 | iftype(undefined).is('object');
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | iftype(123).is('array');
|
48 | iftype(function foo(){}).is('array');
|
49 | iftype(new CustomType()).is('array');
|
50 | iftype(["foo", "bar"]).is('array');
|
51 | iftype("bar").is('array');
|
52 | iftype(null).is('array');
|
53 | iftype(undefined).is('array');
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | iftype(123).is('function');
|
60 | iftype(function foo(){}).is('function');
|
61 | iftype(new CustomType()).is('function');
|
62 | iftype(["foo", "bar"]).is('function');
|
63 | iftype("bar").is('function');
|
64 | iftype(null).is('function');
|
65 | iftype(undefined).is('function');
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | iftype(123).is(CustomType);
|
72 | iftype(function foo(){}).is(CustomType);
|
73 | iftype(new CustomType()).is(CustomType);
|
74 | iftype(["foo", "bar"]).is(CustomType);
|
75 | iftype("bar").is(CustomType);
|
76 | iftype(null).is(CustomType);
|
77 | iftype(undefined).is(CustomType);
|
78 |
|
79 |
|