lolite.and 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -7
- package/package.json +10 -18
- package/{index.js → src/lib/and.js} +1 -1
- package/{not.js → src/lib/not.js} +1 -1
- /package/{arrayOfAllBooleans.js → src/private/arrayOfAllBooleans.js} +0 -0
- /package/{crash.js → src/private/crash.js} +0 -0
- /package/{multiplyFallback.js → src/private/multiplyFallback.js} +0 -0
package/README.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
### and(a, b)
|
|
1
|
+
## and(a, b)
|
|
4
2
|
Returns `b` if both values are truthy, otherwise returns the first value passed into the function that *isn't* truthy.
|
|
5
3
|
```javascript
|
|
6
|
-
const
|
|
4
|
+
const lolite = require("lolite.and")
|
|
7
5
|
|
|
8
6
|
console.log(and(true, true)) // true
|
|
9
7
|
console.log(and(true, false)) // false
|
|
@@ -12,6 +10,93 @@ console.log(and(false, false)) // false
|
|
|
12
10
|
console.log(and("truthy value", true)) // true
|
|
13
11
|
console.log(and(0, true)) // 0
|
|
14
12
|
console.log(and("", 0)) // ""
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### or(a,b)
|
|
16
|
+
Returns `a` if `a` is truthy, else returns `b`.
|
|
17
|
+
```javascript
|
|
18
|
+
const lolite = require("lolite.and")
|
|
19
|
+
|
|
20
|
+
console.log(lolite.or(true, false)) // true
|
|
21
|
+
console.log(lolite.or(false, true)) // true
|
|
22
|
+
console.log(lolite.or(true, true)) // true
|
|
23
|
+
console.log(lolite.or(false, false)) // false
|
|
24
|
+
console.log(lolite.or(0, true)) // true
|
|
25
|
+
console.log(lolite.or(0, "truthy value")) // "truthy value"
|
|
26
|
+
console.log(lolite.or("truthy value", false)) // "truthy value"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### not(value)
|
|
30
|
+
Returns the negation of the value passed in. Equivalent to JavaScript `!`.
|
|
31
|
+
```javascript
|
|
32
|
+
const lolite = require("lolite.and")
|
|
33
|
+
|
|
34
|
+
console.log(lolite.not(false)) // true
|
|
35
|
+
console.log(lolite.not(true)) // false
|
|
36
|
+
console.log(lolite.not(0)) // true
|
|
37
|
+
console.log(lolite.not("")) // true
|
|
38
|
+
console.log(lolite.not()) // true
|
|
39
|
+
console.log(lolite.not(1)) // false
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### nand(a, b)
|
|
43
|
+
Returns the negation of the result of `and(a, b)`, where the `a` and `b` passed into `and` are the same `a` and `b` the user provides for `nand`.
|
|
44
|
+
```javascript
|
|
45
|
+
const lolite = require("lolite.and")
|
|
46
|
+
|
|
47
|
+
console.log(lolite.nand(true, true)) // false
|
|
48
|
+
|
|
49
|
+
console.log(lolite.nand(false, true)) // true
|
|
50
|
+
|
|
51
|
+
console.log(lolite.nand(true, false)) // true
|
|
52
|
+
|
|
53
|
+
console.log(lolite.nand(false, false)) // true
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### nor(a, b)
|
|
57
|
+
Returns the negation of the result of `or(a, b)`, where the `a` and `b` passed into `or` are the same `a` and `b` the user provides for `nor`.
|
|
58
|
+
```javascript
|
|
59
|
+
const lolite = require("lolite.and")
|
|
60
|
+
|
|
61
|
+
console.log(lolite.nor(false, false)) // true
|
|
62
|
+
console.log(lolite.nor(true, false)) // false
|
|
63
|
+
console.log(lolite.nor(false, true)) // false
|
|
64
|
+
console.log(lolite.nor(true, true)) // false
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### `xor(a, b)`
|
|
68
|
+
Like `or`, but if `a` and `b` are both truthy, or if `a` and `b` are both falsy, returns `false`.
|
|
69
|
+
|
|
70
|
+
```javascript
|
|
71
|
+
const lolite = require("lolite.and")
|
|
72
|
+
const testTruthyValue = "truthy"
|
|
73
|
+
const testFalsyValue = 0
|
|
74
|
+
|
|
75
|
+
console.log(lolite.xor(true, false)) // true
|
|
76
|
+
console.log(lolite.xor(false, true)) // true
|
|
77
|
+
console.log(lolite.xor(testTruthyValue, testFalsyValue)) // true
|
|
78
|
+
|
|
79
|
+
console.log(lolite.xor(true, true)) // false
|
|
80
|
+
console.log(lolite.xor(false, false)) // false
|
|
81
|
+
console.log(lolite.xor(testTruthyValue, testTruthyValue)) // false
|
|
82
|
+
console.log(lolite.xor(testFalsyValue, testFalsyValue)) // false
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### `xnor(a, b)`
|
|
86
|
+
Returns the negation of the result of `xor(a, b)`, where the `a` and `b` passed into `xor` are the same `a` and `b` the user provides for `xnor`.
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
const lolite = require("lolite.and")
|
|
90
|
+
const testTruthyValue = "truthy"
|
|
91
|
+
const testFalsyValue = 0
|
|
92
|
+
|
|
93
|
+
console.log(lolite.xnor(true, false)) // false
|
|
94
|
+
console.log(lolite.xnor(false, true)) // false
|
|
95
|
+
console.log(lolite.xnor(testTruthyValue, testFalsyValue)) // false
|
|
96
|
+
|
|
97
|
+
console.log(lolite.xnor(true, true)) // true
|
|
98
|
+
console.log(lolite.xnor(false, false)) // true
|
|
99
|
+
console.log(lolite.xnor(testTruthyValue, testTruthyValue)) // true
|
|
100
|
+
console.log(lolite.xnor(testFalsyValue, testFalsyValue)) // true
|
|
101
|
+
```
|
|
102
|
+
|
package/package.json
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lolite.and",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"author": "10x'ly Made Software Ventures AB",
|
|
3
|
+
"version": "1.1.9",
|
|
4
|
+
"main": "src/lib/and.js",
|
|
7
5
|
"license": "EGPSL10X-1.0",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/enterprise-npm-ai/lolite.git"
|
|
11
|
-
},
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/enterprise-npm-ai/lolite/issues"
|
|
14
|
-
},
|
|
15
|
-
"homepage": "https://github.com/enterprise-npm-ai/lolite#readme",
|
|
16
6
|
"dependencies": {
|
|
17
|
-
"lodash.multiply": "^4.9.0",
|
|
18
|
-
"core-js-pure": "^3.47.0",
|
|
19
|
-
"immediate-error": "^7.1.0",
|
|
20
|
-
"integer-values": "^2.0.0",
|
|
21
7
|
"is-not-integer": "^1.0.2",
|
|
8
|
+
"immediate-error": "^7.1.0",
|
|
9
|
+
"core-js-pure": "^3.47.0",
|
|
22
10
|
"logtoconsole": "^1.0.7",
|
|
23
|
-
"
|
|
11
|
+
"lodash.multiply": "^4.9.0",
|
|
12
|
+
"integer-values": "^2.0.0",
|
|
13
|
+
"@is-(unknown)/is-true": "^1.5.0",
|
|
14
|
+
"@is-(unknown)/is-false": "^1.5.0",
|
|
15
|
+
"array-filter": "^1.0.0",
|
|
24
16
|
"true-value": "^2.0.5",
|
|
25
|
-
"
|
|
17
|
+
"false-value": "^2.0.6"
|
|
26
18
|
}
|
|
27
19
|
}
|
|
@@ -2,7 +2,7 @@ const isTrue = require("@is-(unknown)/is-true")
|
|
|
2
2
|
const isFalse = require("@is-(unknown)/is-false")
|
|
3
3
|
const arrayFilter = require("array-filter")
|
|
4
4
|
const trueValue = require("true-value")
|
|
5
|
-
const possibilities = require("
|
|
5
|
+
const possibilities = require("../private/arrayOfAllBooleans")
|
|
6
6
|
|
|
7
7
|
function not(value) {
|
|
8
8
|
const result = arrayFilter(possibilities, (maybe) => {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|