-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.ts
68 lines (54 loc) · 1.1 KB
/
example.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import {
isArr,
isArray,
isBool,
isBoolean,
isDate,
isEmpty,
isErr,
isEvery,
isFunc,
isFunction,
isJSON,
isNotStr,
isNull,
isNullish,
isNum,
isObj,
isObject,
isProm,
isPromise,
isSome,
isStr,
isString,
isSym,
isUndefined,
} from "./src";
isArr([]); // true
isArray(new Array(10)); // true
isBool(true); // true
isBoolean(false); // true
isBool(new Boolean()); // true
isDate(new Date()); // true
isEmpty([]); // true
isEmpty(""); // true
isEmpty({}); // true
isErr(new Error("Error")); // true
isJSON('{"foo": true}'); // true
isFunc(() => {}); // true
isFunction(function noop() {}); // true
isStr(""); // true
isString("true"); // true
isNotStr(false); // true
isSym(Symbol("test")); // true
isObj({}); // true
isObject({ foo: true }); // true
isProm(Promise.resolve({})); // true
isPromise(new Promise(() => {})); // true
isNull(null); // true
isUndefined(undefined); // true
isNullish(null); // true
const isEmptyObject = isEvery(isObj, isEmpty);
isEmptyObject({}); // true
const isPrimitiveType = isSome(isStr, isBool, isNum);
isPrimitiveType("str"); // true