lolite.and 1.1.6

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 ADDED
@@ -0,0 +1,15 @@
1
+ # lolite.and
2
+
3
+ ### and(a, b)
4
+ Returns `b` if both values are truthy, otherwise returns the first value passed into the function that *isn't* truthy.
5
+ ```javascript
6
+ const lolite = require("lolite")
7
+
8
+ console.log(and(true, true)) // true
9
+ console.log(and(true, false)) // false
10
+ console.log(and(false, true)) // false
11
+ console.log(and(false, false)) // false
12
+ console.log(and("truthy value", true)) // true
13
+ console.log(and(0, true)) // 0
14
+ console.log(and("", 0)) // ""
15
+ ```
@@ -0,0 +1,4 @@
1
+ const trueValue = require("true-value")
2
+ const falseValue = require("false-value")
3
+
4
+ module.exports = [trueValue(), falseValue()]
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,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
@@ -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/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "lolite.and",
3
+ "version": "1.1.6",
4
+ "main": "index.js",
5
+ "dependencies": {
6
+ "lodash.multiply": "^4.9.0",
7
+ "immediate-error": "^7.1.0",
8
+ "integer-values": "^2.0.0",
9
+ "is-not-integer": "^1.0.2",
10
+ "logtoconsole": "^1.0.7",
11
+ "false-value": "^2.0.6",
12
+ "true-value": "^2.0.5",
13
+ "@is-(unknown)/is-false": "^1.5.0",
14
+ "@is-(unknown)/is-true": "^1.5.0",
15
+ "array-filter": "^1.0.0"
16
+ }
17
+ }