-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
50 lines (48 loc) · 1.2 KB
/
index.js
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
const _ = require('lodash');
const allTypeData = [
'',
null,
0,
undefined,
false,
new Date(),
[],
2,
() => {},
'str',
];
const falselyList = allTypeData.filter((v) => !v);
const notStringList = allTypeData.filter((v) => !_.isString(v));
const notObjectList = allTypeData.filter((v) => !_.isObject(v));
const notArrayList = allTypeData.filter((v) => !_.isArray(v));
const notIntList = allTypeData.filter((v) => !_.isSafeInteger(v));
const notDateList = allTypeData.filter((v) => !_.isDate(v));
const notBoolList = allTypeData.filter((v) => !_.isBoolean(v));
const notObjectAndStringList = allTypeData.filter(
(v) => _.isString(v) && !_.isObject(v),
);
const notIntArrayList = [
...notArrayList,
...notIntList.map((v) => Array.from(3).fill(v)),
];
const notStringArrayList = [
...notStringList.filter((v) => !_.isArray(v)),
...notStringList.map((v) => Array.from({ length: 3 }).fill(v)),
];
const notObjectArrayList = [
...notObjectList.map((v) => Array.from({ length: 3 }).fill(v)),
];
module.exports = {
allTypeData,
falselyList,
notStringList,
notObjectList,
notArrayList,
notIntList,
notDateList,
notBoolList,
notObjectAndStringList,
notIntArrayList,
notStringArrayList,
notObjectArrayList,
};