You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: isType.mjs.js
+46-2Lines changed: 46 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,39 @@ const TYPES = {
23
23
weakset: {class: WeakSet},
24
24
};
25
25
26
+
constTYPE_TEST_PROPERTY_NAMES=[
27
+
"array",
28
+
"bigint",
29
+
"boolean",
30
+
"date",
31
+
"defined",
32
+
"empty",
33
+
"error",
34
+
"falsy",
35
+
"function",
36
+
"infinite",
37
+
"map",
38
+
"nan",
39
+
"nonempty",
40
+
"null",
41
+
"nullish",
42
+
"number",
43
+
"numberish",
44
+
"object",
45
+
"objectish",
46
+
"primitive",
47
+
"promise",
48
+
"real",
49
+
"regex",
50
+
"set",
51
+
"string",
52
+
"symbol",
53
+
"truthy",
54
+
"undefined",
55
+
"weakmap",
56
+
"weakset"
57
+
];
58
+
26
59
/**
27
60
* A collection of boolean properties indicating the type of the given value.
28
61
* @class TypeTest
@@ -103,10 +136,21 @@ class TypeTest {
103
136
/**
104
137
* Determine the type of a value. The returned object includes boolean properties to quickly test against specific types or for specific states (e.g., 'empty').
105
138
* @param {*} value - The value to be tested.
106
-
* @returns {TypeTest}
139
+
* @returns {TypeTest} - Plus methods `all` and `any`.
0 commit comments