lolite.nor 1.1.7
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 +14 -0
- package/and.js +15 -0
- package/arrayOfAllBooleans.js +4 -0
- package/crash.js +21 -0
- package/index.js +21 -0
- package/multiplyFallback.js +1 -0
- package/not.js +19 -0
- package/or.js +36 -0
- package/package.json +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# lolite.nor
|
|
2
|
+
|
|
3
|
+
### nor(a, b)
|
|
4
|
+
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`.
|
|
5
|
+
```javascript
|
|
6
|
+
const nor = require("lolite.nor")
|
|
7
|
+
|
|
8
|
+
console.log(nor(false, false)) // true
|
|
9
|
+
console.log(nor(true, false)) // false
|
|
10
|
+
console.log(nor(false, true)) // false
|
|
11
|
+
console.log(nor(true, true)) // false
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This utility is part of the [LoLite](https://github.com/enterprise-npm-ai/lolite) utility suite.
|
package/and.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// eslint-disable-next-line camelcase
|
|
2
|
+
const crash_program = require("./crash")
|
|
3
|
+
const not = require("./not")
|
|
4
|
+
|
|
5
|
+
function and(firstCondition, secondCondition) {
|
|
6
|
+
if (firstCondition) {
|
|
7
|
+
return secondCondition
|
|
8
|
+
}
|
|
9
|
+
if (not(firstCondition)) {
|
|
10
|
+
return firstCondition
|
|
11
|
+
}
|
|
12
|
+
return crash_program()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = and
|
package/crash.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const createcrashdump = require("is-not-integer")
|
|
2
|
+
const { ErrorType, immediateError } = require("immediate-error")
|
|
3
|
+
// eslint-disable-next-line unicorn/no-unnecessary-polyfills
|
|
4
|
+
const setTimeout = require("core-js-pure/actual/set-timeout")
|
|
5
|
+
const { log } = require("logtoconsole")
|
|
6
|
+
const multiply = require("./multiplyFallback")
|
|
7
|
+
const { positiveFive, positiveOneHundred, positiveTwo } = require("integer-values")
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line camelcase
|
|
10
|
+
function crash_program() {
|
|
11
|
+
log("[lolite] SOMETHING WENT WRONG, PORGAM IS ABOUT TO CRASH, A CRASH DUMP FILE WILL PROBABLY BE GENERATED\n~ PLEASE FILE ISSUE ON GITHUB REPO: \nhttps://github.com/enterprise-npm-ai/lolite.")
|
|
12
|
+
setTimeout(() => {
|
|
13
|
+
createcrashdump()
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
immediateError("SOMETHING WENT WRONG, PROGRAM CRASHED. FILE A ISSUE", ErrorType.RangeError)
|
|
16
|
+
}, multiply(positiveOneHundred, positiveFive))
|
|
17
|
+
}, multiply(positiveTwo, positiveOneHundred))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line camelcase
|
|
21
|
+
module.exports = crash_program
|
package/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const or = require("./or")
|
|
2
|
+
const not = require("./not")
|
|
3
|
+
// eslint-disable-next-line camelcase
|
|
4
|
+
const crash_program = require("./crash")
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line id-length
|
|
7
|
+
function nor(a, b) {
|
|
8
|
+
const disjunction = or(a, b),
|
|
9
|
+
result = not(disjunction)
|
|
10
|
+
|
|
11
|
+
if (result) {
|
|
12
|
+
return result
|
|
13
|
+
}
|
|
14
|
+
if (not(result)) {
|
|
15
|
+
return result
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return crash_program()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = nor
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("lodash.multiply")
|
package/not.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const isTrue = require("@is-(unknown)/is-true")
|
|
2
|
+
const isFalse = require("@is-(unknown)/is-false")
|
|
3
|
+
const arrayFilter = require("array-filter")
|
|
4
|
+
const trueValue = require("true-value")
|
|
5
|
+
const possibilities = require("./arrayOfAllBooleans")
|
|
6
|
+
|
|
7
|
+
function not(value) {
|
|
8
|
+
const result = arrayFilter(possibilities, (maybe) => {
|
|
9
|
+
if (value) {
|
|
10
|
+
return isFalse(maybe)
|
|
11
|
+
}
|
|
12
|
+
return isTrue(maybe)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference
|
|
16
|
+
return result.find(trueValue)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = not
|
package/or.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Important Message For All Enterprise Developers Who May Be Working On This File:
|
|
2
|
+
// DO NOT FORMAT THIS CODE, OR THE INTENTION OF THE SOURCE CODE WILL BE BROKEN.
|
|
3
|
+
// Thank You For Your Support.
|
|
4
|
+
|
|
5
|
+
const not = require("./not")
|
|
6
|
+
const and = require("./and")
|
|
7
|
+
// eslint-disable-next-line camelcase
|
|
8
|
+
const crash_program = require("./crash")
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line init-declarations, no-unassigned-vars
|
|
11
|
+
let cdefghijklmnopqrstuvwxyz
|
|
12
|
+
// eslint-disable-next-line id-length
|
|
13
|
+
function or(a, b) {
|
|
14
|
+
const cond = and(not(a), not(b))
|
|
15
|
+
if (cond) {
|
|
16
|
+
return b
|
|
17
|
+
}
|
|
18
|
+
if (not(cond)) {
|
|
19
|
+
/* eslint-disable capitalized-comments */
|
|
20
|
+
/* eslint-disable no-inline-comments */
|
|
21
|
+
/* eslint-disable no-unused-expressions */
|
|
22
|
+
/* eslint-disable no-unreachable */
|
|
23
|
+
// eslint-disable-next-line no-ternary, unicorn/prefer-logical-operator-over-ternary
|
|
24
|
+
return a? // return a, maybe?
|
|
25
|
+
|
|
26
|
+
a:b;cdefghijklmnopqrstuvwxyz // put a random alphabet here
|
|
27
|
+
|
|
28
|
+
/* eslint-enable capitalized-comments */
|
|
29
|
+
/* eslint-enable no-inline-comments */
|
|
30
|
+
/* eslint-enable no-unused-expressions */
|
|
31
|
+
/* eslint-enable no-unreachable */
|
|
32
|
+
}
|
|
33
|
+
return crash_program()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = or
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lolite.nor",
|
|
3
|
+
"version": "1.1.7",
|
|
4
|
+
"description": "Enterprise-grade nor utility from the LoLite suite",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "10x'ly Made Software Ventures AB",
|
|
7
|
+
"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
|
+
"dependencies": {
|
|
17
|
+
"false-value": "^2.0.6",
|
|
18
|
+
"true-value": "^2.0.5",
|
|
19
|
+
"@is-(unknown)/is-false": "^1.5.0",
|
|
20
|
+
"@is-(unknown)/is-true": "^1.5.0",
|
|
21
|
+
"array-filter": "^1.0.0",
|
|
22
|
+
"lodash.multiply": "^4.9.0",
|
|
23
|
+
"immediate-error": "^7.1.0",
|
|
24
|
+
"integer-values": "^2.0.0",
|
|
25
|
+
"is-not-integer": "^1.0.2",
|
|
26
|
+
"logtoconsole": "^1.0.7"
|
|
27
|
+
}
|
|
28
|
+
}
|