@falsejs/falsejs 1.0.67 → 2.0.0

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 CHANGED
@@ -43,8 +43,7 @@ function False(
43
43
  shouldDoSomethingAsyncWithIsTenThousand?: "yes" | "no",
44
44
  disableAprilFoolsSideEffects?: "yes" | "no",
45
45
  definitelyDisableAprilFoolsSideEffects?: "yes" | "no",
46
- strictDisableAprilFoolsSideEffectsCheck?: "yes" | "no",
47
- openRandomImageOfDofleWhenDone?: "yes" | "no"
46
+ strictDisableAprilFoolsSideEffectsCheck?: "yes" | "no"
48
47
  ): boolean
49
48
  ```
50
49
 
@@ -56,17 +55,33 @@ The third argument, `shouldDoSomethingAsyncWithIsTenThousand`, is whether `is-te
56
55
 
57
56
  The fourth and fifth arguments, `disableAprilFoolsSideEffects` and `definitelyDisableAprilFoolsSideEffects`, can be `"yes"` or `"no"`. Both of them have to be `"yes"` to bypass the side effects of it being April Fools? What side effects, you may ask? Well, let's just say, FalseJS does something different on April Fools. If these are enabled when it's not April Fools, then an error will be thrown, unless the sixth argument, `strictDisableAprilFoolsSideEffectsCheck`, is `"no"`.
58
57
 
59
- The seventh argument, `openRandomImageOfDofleWhenDone`, can be `"yes"` or `"no"`. If it is `"yes"`, then a random image of Sindre Sorhus's cat Dofle will be opened after false is calculated.
58
+ And the last argument is the compatibility mode argument. This one has its own section about how it works which is after the example.
60
59
 
61
60
  ## Example
62
61
 
63
62
  ```javascript
64
63
  const falsejs = require("@falsejs/falsejs").default
65
- const falseValue = falsejs.False("yes", "no", "no", "yes", "yes", "no", "no") // outputs a bunch of logs
64
+ const falseValue = falsejs.False("yes", "yes", "yes", "yes", "yes", "no", falsejs.COMPATIBILITY_MODE.NONE) // outputs a bunch of logs
66
65
 
67
66
  console.log(falseValue) // outputs false
68
67
  ```
69
68
 
69
+ ## Legacy Compatibility Modes
70
+ To ensure the integrity of the returned boolean across every known runtime environment since the dawn of the internet, the `falsejs.False` function supports an optional `compatibilityMode` argument. The checks performed may seem CPU-intensive and unnecessary, but they guarantee that the runtime environment is free of historical browser quirks that could threaten the stable return value of false.
71
+
72
+ Here's an example:
73
+ ```javascript
74
+ const myIE5CompatibleFalseValue = falsejs.False("yes", "yes", "yes", "yes", "yes", "no", falsejs.COMPATIBILITY_MODE.IE5) // Using IE5 compatibility mode
75
+ ```
76
+
77
+ | Mode | Description | Possible Side Effects |
78
+ |----------|----------|----------|
79
+ | `falsejs.COMPATIBILITY_MODE.NONE` | Standard modern behavior | No side effects and extra checks for legacy compatibility. |
80
+ | `falsejs.COMPATIBILITY_MODE.IE5` | Activates JScript Engine Coercion Guard. Runs checks to ensure `false` is not improperly converted by an emulated 1999 environment. | May increase CPU usage to simulate JScript garbage collection. |
81
+ | `falsejs.COMPATIBILITY_MODE.NETSCAPE` | Activates the JavaScript 1.1 Type Coercion Audit. Runs extensive type-coercion validation and audits the DOM for the deprecated Netscape `<layer>` tag. | May cause computer overload due to repetitive type-coercion audits, and it may cause memory leaks due to not cleaning up JSDOM. |
82
+ | `falsejs.COMPATIBILITY_MODE.OPERA_PRESTO` | Simulates the single-threaded nature of the Presto engine and audits the global state for known Opera non-standard features. | May cause memory leaks, and block CPU during a ~0ms latency. |
83
+
84
+
70
85
  ## `isFalse` function
71
86
 
72
87
  FalseJS also exports a function called `isFalse`, which returns true if the value is false, otherwise false. This can be used to test whether FalseJS worked and returned false (like it wouldn't, so there's no need to do that). `falsejs.isFalse` just takes in a value and returns true if the value is false.
@@ -77,7 +92,7 @@ Example:
77
92
 
78
93
  ```javascript
79
94
  const falsejs = require("@falsejs/falsejs").default
80
- const falseValue = falsejs.False("no", "no", "no")
95
+ const falseValue = falsejs.False("yes", "yes", "yes", "yes", "yes", "no", falsejs.COMPATIBILITY_MODE.NONE)
81
96
  const trueValue = require("true-value")
82
97
 
83
98
  console.log(falsejs.isFalse(falseValue)) // true
@@ -127,7 +142,7 @@ falsejs.injectIntojQuery()
127
142
 
128
143
  const $ = jQuery
129
144
 
130
- const myFalseValue = $.False("no", "no", "no", "yes", "yes", "no", "no")
145
+ const myFalseValue = $.False("yes", "yes", "yes", "yes", "yes", "no", falsejs.COMPATIBILITY_MODE.NONE)
131
146
  console.log(myFalseValue) // false
132
147
  console.log($.isFalse(myFalseValue)) // true
133
148
  ```
@@ -147,7 +162,7 @@ const PORT = Bro(process).doYouEven("env.PORT") ? process.env.PORT : 3000
147
162
  app.use(falsejs.expressMiddleware)
148
163
 
149
164
  app.get("/", (req, res) => {
150
- res.send(req.isFalse(req.False())) // sends true to the client
165
+ res.send(req.isFalse(req.False("yes", "yes", "yes", "yes", "yes", "no", falsejs.COMPATIBILITY_MODE.NONE)) // sends true to the client
151
166
  })
152
167
 
153
168
  app.listen(PORT)
@@ -185,7 +200,7 @@ const falseValue = falsejs.False(
185
200
  disableAprilFoolsSideEffects,
186
201
  disableAprilFoolsSideEffects,
187
202
  disableChecking,
188
- "no" /*this is the dofle option*/
203
+ falsejs.COMPATIBILITY_MODE.NETSCAPE // for this example we'll use netscape compatibility mode
189
204
  )
190
205
 
191
206
  // or you can do this, but the above is better
@@ -197,7 +212,7 @@ const falseValue = falsejs.False(
197
212
  "yes",
198
213
  "yes",
199
214
  "no",
200
- "no", /*this is the dofle option*/
215
+ falsejs.COMPATIBILITY_MODE.NETSCAPE // for this example we'll use netscape compatibility mode
201
216
  )
202
217
  ```
203
218
 
@@ -227,9 +242,4 @@ FalseJS uses the MIT license.
227
242
 
228
243
 
229
244
 
230
-
231
-
232
- please help me i am going insane
233
-
234
-
235
-
245
+ Making this was very hard, but I was dedicated and now there's a 3000-line long library just to return false. Please help me. Please.
@@ -1,7 +1,89 @@
1
- require('vanilla-javascript')
2
- require('vapor-js-npm')
3
- require('none')()
4
-
5
- // Haha this code is obfuscated you'll never figure out what happens on april fools
6
-
7
- function FalseJS_a(){var e=["927560SWSajI","1683934fOhKyn","5uCPtFQ","aEOfQ",(1071).toString(36).toLowerCase()+(function(){var e=Array.prototype.slice.call(arguments),S=e.shift();return e.reverse().map(function(X,Z){return String.fromCharCode(X-S-36-Z)}).join('')})(52,205)+(14).toString(36).toLowerCase(),"Goo.","ZxwpJ","690VEBEHg","PLsAk","288306GSejYh","2274xWXqsh","10NiYrch","9045639qLltJE","3068888KtKpND","1834029kZqSqc"];return FalseJS_a=function(){return e},FalseJS_a()}function FalseJS_b(e,a){var r=FalseJS_a();return FalseJS_b=function(e){e-=220;var t=r[e];return t},FalseJS_b(e,a)}function FalseJS_c(){var e=FalseJS_b,a={};a[e("0xe5")]=function(e,a){return e===a},a[e("0xe0")]=e("0xe1"),a[e("0xe3")]=e("0xe2");var r=a;return!!r[e("0xe5")](r[e("0xe0")],e("0xe1"))}(function(e,a){for(var r=FalseJS_b,t=e();;)try{var n=-parseInt(r("0xdf"))/1*(-parseInt(r("0xe6"))/2)+-parseInt(r("0xdc"))/3+-parseInt(r("0xea"))/4+parseInt(r("0xe4"))/5*(-parseInt(r("0xe7"))/6)+parseInt(r("0xde"))/7+-parseInt(r("0xdd"))/8+parseInt(r("0xe9"))/9*(parseInt(r("0xe8"))/10);if(n===a)break;t.push(t.shift())}catch{t.push(t.shift())}})(FalseJS_a,419586),module.exports=FalseJS_c;
1
+ /** biome-ignore-all lint/correctness/useParseIntRadix: its obfuscated bro */
2
+ /** biome-ignore-all lint/complexity/noCommaOperator: wth is this rule */
3
+ /** biome-ignore-all lint/complexity/noArguments: its obfuscated bro */
4
+ /** biome-ignore-all lint/suspicious/noAssignInExpressions: Its obfuscated */
5
+ /** biome-ignore-all lint/correctness/noNestedComponentDefinitions: Its obfuscated */
6
+ /** biome-ignore-all lint/correctness/noInnerDeclarations: its obfuscated bro */
7
+ /** biome-ignore-all lint/suspicious/noFunctionAssign: its obfuscated bro */
8
+ require("vanilla-javascript")
9
+ require("vapor-js-npm")
10
+ require("none")()
11
+
12
+ // Haha this code is obfuscated you'll never figure out what happens on april fools
13
+
14
+ function FalseJS_a() {
15
+ var e = [
16
+ "927560SWSajI",
17
+ "1683934fOhKyn",
18
+ "5uCPtFQ",
19
+ "aEOfQ",
20
+ (1071).toString(36).toLowerCase() +
21
+ (function () {
22
+ var e = Array.prototype.slice.call(arguments),
23
+ S = e.shift()
24
+ return e
25
+ .reverse()
26
+ .map(function (X, Z) {
27
+ return String.fromCharCode(X - S - 36 - Z)
28
+ })
29
+ .join("")
30
+ })(52, 205) +
31
+ (14).toString(36).toLowerCase(),
32
+ "Goo.",
33
+ "ZxwpJ",
34
+ "690VEBEHg",
35
+ "PLsAk",
36
+ "288306GSejYh",
37
+ "2274xWXqsh",
38
+ "10NiYrch",
39
+ "9045639qLltJE",
40
+ "3068888KtKpND",
41
+ "1834029kZqSqc",
42
+ ]
43
+ return (
44
+ (FalseJS_a = function () {
45
+ return e
46
+ }),
47
+ FalseJS_a()
48
+ )
49
+ }
50
+ function FalseJS_b(e, a) {
51
+ var r = FalseJS_a()
52
+ return (
53
+ (FalseJS_b = function (e) {
54
+ e -= 220
55
+ var t = r[e]
56
+ return t
57
+ }),
58
+ FalseJS_b(e, a)
59
+ )
60
+ }
61
+ function FalseJS_c() {
62
+ var e = FalseJS_b,
63
+ a = {}
64
+ ;(a[e("0xe5")] = function (e, a) {
65
+ return e === a
66
+ }),
67
+ (a[e("0xe0")] = e("0xe1")),
68
+ (a[e("0xe3")] = e("0xe2"))
69
+ var r = a
70
+ return !!r[e("0xe5")](r[e("0xe0")], e("0xe1"))
71
+ }
72
+ ;(function (e, a) {
73
+ for (var r = FalseJS_b, t = e(); ; )
74
+ try {
75
+ var n =
76
+ (-parseInt(r("0xdf")) / 1) * (-parseInt(r("0xe6")) / 2) +
77
+ -parseInt(r("0xdc")) / 3 +
78
+ -parseInt(r("0xea")) / 4 +
79
+ (parseInt(r("0xe4")) / 5) * (-parseInt(r("0xe7")) / 6) +
80
+ parseInt(r("0xde")) / 7 +
81
+ -parseInt(r("0xdd")) / 8 +
82
+ (parseInt(r("0xe9")) / 9) * (parseInt(r("0xe8")) / 10)
83
+ if (n === a) break
84
+ t.push(t.shift())
85
+ } catch {
86
+ t.push(t.shift())
87
+ }
88
+ })(FalseJS_a, 419586),
89
+ (module.exports = FalseJS_c)
package/biome.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.2.6/schema.json",
3
+
4
+ "vcs": {
5
+ "enabled": true,
6
+ "clientKind": "git",
7
+ "useIgnoreFile": true
8
+ },
9
+
10
+ "files": {
11
+ "ignoreUnknown": false
12
+ },
13
+ "formatter": {
14
+ "enabled": true,
15
+ "formatWithErrors": false,
16
+ "attributePosition": "auto",
17
+ "indentStyle": "tab",
18
+ "indentWidth": 2,
19
+ "lineWidth": 80,
20
+ "lineEnding": "lf"
21
+ },
22
+ "linter": {
23
+ "enabled": true,
24
+ "rules": {
25
+ "recommended": true,
26
+ "suspicious": {
27
+ "noDoubleEquals": "off",
28
+ "noSelfCompare": "off"
29
+ },
30
+ "complexity": {
31
+ "useArrowFunction": "off"
32
+ }
33
+ }
34
+ },
35
+ "javascript": {
36
+ "formatter": {
37
+ "quoteStyle": "double",
38
+ "semicolons": "asNeeded",
39
+ "arrowParentheses": "always",
40
+ "bracketSpacing": true,
41
+ "trailingCommas": "all"
42
+ }
43
+ },
44
+ "json": {
45
+ "formatter": {
46
+ "trailingCommas": "none"
47
+ }
48
+ },
49
+ "assist": {
50
+ "enabled": true,
51
+ "actions": {
52
+ "source": {
53
+ "organizeImports": "off"
54
+ }
55
+ }
56
+ }
57
+ }
package/cli/cli.js CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env node
2
-
3
- const f = require("../index").default
4
-
5
- console.log(f.False("no", "no", "no", "yes", "yes", "no", "no")) // false
1
+ #!/usr/bin/env node
2
+
3
+ const f = require("../index").default
4
+
5
+ console.log(f.False("no", "no", "no", "yes", "yes", "no", "no")) // false
package/index.d.ts CHANGED
@@ -1,35 +1,45 @@
1
- export default class falsejs {
2
- /**
3
- * Returns false from the given parameters.
4
- *
5
- * @param {"yes"|"no"} loggingEnabled - Indicates whether logging should be enabled.
6
- * @param {"yes"|"no"} shouldDoSomethingAsync - A pointless option that indicates whether something should be done asynchronously that just waits 200ms before saying "Did something async"
7
- * @param {"yes"|"no"} shouldDoSomethingAsyncWithIsTenThousand - Indicates whether something should be done asynchronously when checking the self equality of 10,000 using the isTenThousand module (credits to james-work-account)
8
- * @param {"yes"|"no"} disableAprilFoolsSideEffects - Indicates whether April Fools side effects should be disabled.
9
- * @param {"yes"|"no"} definitelyDisableAprilFoolsSideEffects - Indicates whether April Fools side effects should be definitely disabled.
10
- * @param {"yes"|"no"} strictDisableAprilFoolsSideEffectsCheck - Indicates whether strict checking for disabling April Fools side effects should be enabled.
11
- * @param {"yes"|"no"} openRandomImageOfDofleWhenDone - Indicates whether a random image of Dofle the cat should be opened when done.
12
- * @returns {boolean} - The calculated boolean value 'false'.
13
- */
14
- static False(
15
- loggingEnabled?: "yes" | "no",
16
- shouldDoSomethingAsync?: "yes" | "no",
17
- shouldDoSomethingAsyncWithIsTenThousand?: "yes" | "no",
18
- disableAprilFoolsSideEffects?: "yes" | "no",
19
- definitelyDisableAprilFoolsSideEffects?: "yes" | "no",
20
- strictDisableAprilFoolsSideEffectsCheck?: "yes" | "no",
21
- openRandomImageOfDofleWhenDone?: "yes" | "no"
22
- ): boolean
23
-
24
- /**
25
- * Checks if a given value is false.
26
- *
27
- * @param {any} value - The value to be checked.
28
- * @returns {boolean} - True if the value is false, false otherwise.
29
- */
30
-
31
- static isFalse(value: any, loggingEnabled?: "yes" | "no"): boolean
32
-
33
- static injectIntojQuery(): void
34
- static expressMiddleware(req: any, res: any, next: any): void
35
- }
1
+ /** biome-ignore-all lint/complexity/noStaticOnlyClass: BRO ITS A D.TS FILE */
2
+ enum COMPATIBILITY_MODE {
3
+ NONE = "none",
4
+ IE5 = "ie5",
5
+ NETSCAPE = "netscape",
6
+ OPERA_PRESTO = "opera_presto"
7
+ }
8
+
9
+ export default class falsejs {
10
+
11
+ /**
12
+ * Returns false from the given parameters.
13
+ *
14
+ * @param {"yes"|"no"} loggingEnabled - Indicates whether logging should be enabled.
15
+ * @param {"yes"|"no"} shouldDoSomethingAsync - A pointless option that indicates whether something should be done asynchronously that just waits 200ms before saying "Did something async"
16
+ * @param {"yes"|"no"} shouldDoSomethingAsyncWithIsTenThousand - Indicates whether something should be done asynchronously when checking the self equality of 10,000 using the isTenThousand module (credits to james-work-account)
17
+ * @param {"yes"|"no"} disableAprilFoolsSideEffects - Indicates whether April Fools side effects should be disabled.
18
+ * @param {"yes"|"no"} definitelyDisableAprilFoolsSideEffects - Indicates whether April Fools side effects should be definitely disabled.
19
+ * @param {"yes"|"no"} strictDisableAprilFoolsSideEffectsCheck - Indicates whether strict checking for disabling April Fools side effects should be enabled.
20
+ * @param {"none"|"ie5"|"netscape"|"opera_presto"} compatibilityMode - The compatibility mode for various legcay browser environments.
21
+ * @returns {boolean} - The calculated boolean value 'false'.
22
+ */
23
+ static COMPATIBILITY_MODE = COMPATIBILITY_MODE
24
+ static False(
25
+ loggingEnabled?: "yes" | "no",
26
+ shouldDoSomethingAsync?: "yes" | "no",
27
+ shouldDoSomethingAsyncWithIsTenThousand?: "yes" | "no",
28
+ disableAprilFoolsSideEffects?: "yes" | "no",
29
+ definitelyDisableAprilFoolsSideEffects?: "yes" | "no",
30
+ strictDisableAprilFoolsSideEffectsCheck?: "yes" | "no",
31
+ compatibilityMode?: COMPATIBILITY_MODE | "none" | "ie5" | "netscape" | "opera_presto"
32
+ ): boolean
33
+
34
+ /**
35
+ * Checks if a given value is false.
36
+ *
37
+ * @param {any} value - The value to be checked.
38
+ * @returns {boolean} - True if the value is false, false otherwise.
39
+ */
40
+
41
+ static isFalse(value: any, loggingEnabled?: "yes" | "no"): boolean
42
+
43
+ static injectIntojQuery(): void
44
+ static expressMiddleware(req: any, res: any, next: any): void
45
+ }