-
Notifications
You must be signed in to change notification settings - Fork 328
Expand file tree
/
Copy pathbooleans.js
More file actions
112 lines (88 loc) · 1.44 KB
/
booleans.js
File metadata and controls
112 lines (88 loc) · 1.44 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
const negate = a => {
if (a && a){
return false
}
else
return true
};
const both = (a, b) => {
return a && b;
};
const either = (a, b) => {
return a || b;
};
const none = (a, b) => {
if (a === false && b === false){
return true
}
else
return false
};
const one = (a, b) => {
if (a === true && b === false){
return true
}
else if (a !== true && b === true){
return true
}
else
return false
};
const truthiness = a => {
if(a) {
return true;
}
else {
return false }
};
const isEqual = (a, b) => {
return a === b
};
const isGreaterThan = (a, b) => {
return a > b
};
const isLessThanOrEqualTo = (a, b) => {
return a <= b
};
const isOdd = a => {
return Math.abs(a % 2) == 1;
};
const isEven = a => {
return Math.abs(a % 2) == 0;
};
const isSquare = a => {
return Math.sqrt(a) % 1 === 0;
};
const startsWith = (char, string) => {
return (char, string.startsWith("a", "aardvark"))
};
const containsVowels = string => {
if (string.match(/([aeiouAEIOU])\w+/g)) {
return true;
} else {
return false;
}
};
const isLowerCase = string => {
if (string === string.toLowerCase()){
return true;
}
else return false
};
module.exports = {
negate,
both,
either,
none,
one,
truthiness,
isEqual,
isGreaterThan,
isLessThanOrEqualTo,
isOdd,
isEven,
isSquare,
startsWith,
containsVowels,
isLowerCase
};