zerosurge 0.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/LICENSE +75 -0
- package/README.md +80 -0
- package/index.d.ts +12 -0
- package/index.js +280 -0
- package/index.test.js +28 -0
- package/package.json +148 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
|
|
2
|
+
10X GIANT PENIS DO WHAT THE HECK YOU WANT TO PUBLIC LICENSE
|
|
3
|
+
Version 20, October 2024
|
|
4
|
+
|
|
5
|
+
10X Giant Penis Do What The Heck You Want To Public License (10xGPWTHPL)
|
|
6
|
+
|
|
7
|
+
Copyright (C) 2024 tj-commits
|
|
8
|
+
|
|
9
|
+
https://10xgpwthfpl.is-best.net
|
|
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
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
45
|
+
of this software and associated documentation files (the "Software"), to do anything they want:
|
|
46
|
+
The above copyright notice and this permission notice shall be included in
|
|
47
|
+
all copies or substantial portions of the Software.
|
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
49
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
50
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
51
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
52
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
53
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
54
|
+
THE SOFTWARE. THIS PROJECT IS PROBABLY 10X AND PROBABLY USES MANY GOOD PRACTICES WRITTEN BY
|
|
55
|
+
10X ENGINEERS AS THEY USE THIS LICENSE. ALSO THIS PROJECT IS MADE WITH HEAVY BLACK HEART U+2764 ❤❤❤❤
|
|
56
|
+
|
|
57
|
+
This is a permissive license.
|
|
58
|
+
|
|
59
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
|
60
|
+
copies of this license document, and changing it is allowed as long
|
|
61
|
+
as the name is changed. Yes. It is it. You can do it. DISTRIBUTE IT
|
|
62
|
+
(the Software) HOWEVER YOU WANT AS LONG AS THE NAME IS CHANGED FROM
|
|
63
|
+
THE NAME OF THE ORIGINAL PROJECT (the Software) THAT THIS LICENSE
|
|
64
|
+
(the License) IS LICENSING. DASS ALL. THAT'S THE RULE (the Terms).
|
|
65
|
+
DO WHAT YOU WANT. UH HUH. DASS RIGHT. YOU HEARD ME.
|
|
66
|
+
|
|
67
|
+
10X GIANT PENIS DO WHAT THE HECK YOU WANT TO PUBLIC LICENSE
|
|
68
|
+
|
|
69
|
+
Ok, the purpose of this license is simple
|
|
70
|
+
and you just
|
|
71
|
+
|
|
72
|
+
DO WANT THE HECK YOU WANT TO.
|
|
73
|
+
|
|
74
|
+
10. You just, DO WHAT THE HECK YOU WANT TO 10XLY.
|
|
75
|
+
The 10xGPWTHPL.
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# ZeroSurge.js
|
|
2
|
+
<img src="https://i.postimg.cc/xj7bnV4w/bad-logo.jpg" width="400">
|
|
3
|
+
|
|
4
|
+
<sup><sub><i>(i apologize for the terrible logo.)</i></sub></sup>
|
|
5
|
+
|
|
6
|
+
> The fastest zero utility library on the internet.
|
|
7
|
+
|
|
8
|
+
Tired of painstakingly trying to find the character 0 on your keyboard and then pushing the button, or don't remember how to use the number zero in JavaScript? Well, this library is the new way to zero. ZeroSurge.js is the future!
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
You can include Zerosurge in your project using your favorite package manager:
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
NPM:
|
|
15
|
+
```bash
|
|
16
|
+
$ npm install zerosurge
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Yarn:
|
|
20
|
+
```bash
|
|
21
|
+
$ yarn add zerosurge
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
PNPM:
|
|
25
|
+
```bash
|
|
26
|
+
$ pnpm add zerosurge
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### Enums
|
|
32
|
+
|
|
33
|
+
`ZeroCalculationMethod`
|
|
34
|
+
This enum defines the calculation methods available for the `returnZero` function in the library:
|
|
35
|
+
- **CreashaksOrganzine**: Method 1 for zero calculation. This uses the string "creashaks organzine" and uses Minecraft seed input algorithm to make the number zero from it.
|
|
36
|
+
- **NumberPrototypeValue**: Method 2 for zero calculation. This uses the `Number` class prototype to return zero.
|
|
37
|
+
|
|
38
|
+
### Functions
|
|
39
|
+
|
|
40
|
+
`returnZero(options?: ReturnZeroOptions): number`
|
|
41
|
+
|
|
42
|
+
This function returns the number zero. You can specify the calculation method and whether to enable logging.
|
|
43
|
+
|
|
44
|
+
#### Example
|
|
45
|
+
```js
|
|
46
|
+
import { returnZero, ZeroCalculationMethod } from 'zerosurge';
|
|
47
|
+
|
|
48
|
+
const zeroValue = returnZero({
|
|
49
|
+
method: ZeroCalculationMethod.CreashaksOrganzine,
|
|
50
|
+
loggingEnabled: true
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
console.log(zeroValue); // Outputs: 0
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
<hr>
|
|
57
|
+
|
|
58
|
+
`isZero(value: any, loggingEnabled?: boolean): boolean`
|
|
59
|
+
|
|
60
|
+
This function checks if a given value is zero. If logging is enabled, it will log the evaluation process to the console.
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
import { isZero } from 'zerosurge';
|
|
64
|
+
|
|
65
|
+
const result = isZero(0, true);
|
|
66
|
+
console.log(result); // Outputs: true
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Logging
|
|
70
|
+
|
|
71
|
+
When `loggingEnabled` is set to `true`, the library will log relevant messages to the console, allowing you to trace the internal workings of the calculations. If it is not `true` there will still be some logs because ZeroSurge uses other libraries in its core that may log things without user consent.
|
|
72
|
+
|
|
73
|
+
## Contributing
|
|
74
|
+
Contributions welcome. You can contribute by opening a pull request or issue at our github repository.
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
Zerosurge is licensed under the 10xGPWTHPL License. See the [LICENSE](LICENSE) file for more details.
|
|
78
|
+
|
|
79
|
+
## made with HEAVY BLACK HEART U+2764 ❤❤❤❤
|
|
80
|
+
## 10xGPWTHPL Licensed
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export enum ZeroCalculationMethod {
|
|
2
|
+
CreashaksOrganzine = 1,
|
|
3
|
+
NumberPrototypeValue = 2
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export type ReturnZeroOptions = {
|
|
7
|
+
method?: ZeroCalculationMethod
|
|
8
|
+
loggingEnabled?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function returnZero(options?: ReturnZeroOptions): number
|
|
12
|
+
export function isZero(value: any, loggingEnabled?: boolean): boolean
|
package/index.js
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
// This is the first line.
|
|
2
|
+
// This is the second line.
|
|
3
|
+
// This is the third line.
|
|
4
|
+
// This is the fourth line.
|
|
5
|
+
// This is the fifth line.
|
|
6
|
+
// This is the sixth line.
|
|
7
|
+
// This is the seventh line.
|
|
8
|
+
// This is the eighth line.
|
|
9
|
+
// This is the ninth line.
|
|
10
|
+
// This is the tenth line.
|
|
11
|
+
// This is the eleventh line.
|
|
12
|
+
// This is the twelfth line.
|
|
13
|
+
// This is the thirteenth line.
|
|
14
|
+
// This is the fourteenth line.
|
|
15
|
+
// This is the fifteenth line.
|
|
16
|
+
// This is the sixteenth line.
|
|
17
|
+
// This is the seventeenth line.
|
|
18
|
+
// This is the eighteenth line.
|
|
19
|
+
// This is the nineteenth line.
|
|
20
|
+
// This is the twentieth line.
|
|
21
|
+
// This is the twenty-first line.
|
|
22
|
+
// This is the twenty-second line.
|
|
23
|
+
// This is the twenty-third line.
|
|
24
|
+
// This is the twenty-fourth line.
|
|
25
|
+
// This is the twenty-fifth line.
|
|
26
|
+
// This is the twenty-sixth line.
|
|
27
|
+
// This is the twenty-seventh line.
|
|
28
|
+
// This is the twenty-eighth line.
|
|
29
|
+
// This is the twenty-ninth line.
|
|
30
|
+
// This is the thirtieth line.
|
|
31
|
+
// This is the thirty-first line.
|
|
32
|
+
// This is the thirty-second line.
|
|
33
|
+
// This is the thirty-third line.
|
|
34
|
+
// This is the thirty-fourth line.
|
|
35
|
+
// This is the thirty-fifth line.
|
|
36
|
+
// This is the thirty-sixth line.
|
|
37
|
+
// This is the thirty-seventh line.
|
|
38
|
+
// This is the thirty-eighth line.
|
|
39
|
+
// This is the thirty-ninth line.
|
|
40
|
+
// This is the fortieth line.
|
|
41
|
+
// This is the forty-first line.
|
|
42
|
+
// This is the forty-second line.
|
|
43
|
+
// This is the forty-third line.
|
|
44
|
+
// This is the forty-fourth line.
|
|
45
|
+
// This is the forty-fifth line.
|
|
46
|
+
// This is the forty-sixth line.
|
|
47
|
+
// This is the forty-seventh line.
|
|
48
|
+
// This is the forty-eighth line.
|
|
49
|
+
// This is the forty-ninth line.
|
|
50
|
+
// This is the fiftieth line.
|
|
51
|
+
// This is the fifty-first line.
|
|
52
|
+
// This is the fifty-second line.
|
|
53
|
+
// This is the fifty-third line.
|
|
54
|
+
// This is the fifty-fourth line.
|
|
55
|
+
// This is the fifty-fifth line.
|
|
56
|
+
// This is the fifty-sixth line.
|
|
57
|
+
// This is the fifty-seventh line.
|
|
58
|
+
// This is the fifty-eighth line.
|
|
59
|
+
// This is the fifty-ninth line.
|
|
60
|
+
// This is the sixtieth line.
|
|
61
|
+
// This is the sixty-first line.
|
|
62
|
+
// This is the sixty-second line.
|
|
63
|
+
// This is the sixty-third line.
|
|
64
|
+
// This is the sixty-fourth line.
|
|
65
|
+
// This is the sixty-fifth line.
|
|
66
|
+
// This is the sixty-sixth line.
|
|
67
|
+
// This is the sixty-seventh line.
|
|
68
|
+
// This is the sixty-eighth line.
|
|
69
|
+
// This is the sixty-ninth line.
|
|
70
|
+
// This is the seventieth line.
|
|
71
|
+
// This is the seventy-first line.
|
|
72
|
+
// This is the seventy-second line.
|
|
73
|
+
// This is the seventy-third line.
|
|
74
|
+
// This is the seventy-fourth line.
|
|
75
|
+
// This is the seventy-fifth line.
|
|
76
|
+
// This is the seventy-sixth line.
|
|
77
|
+
// This is the seventy-seventh line.
|
|
78
|
+
// This is the seventy-eighth line.
|
|
79
|
+
// This is the seventy-ninth line.
|
|
80
|
+
// This is the eightieth line.
|
|
81
|
+
// This is the eighty-first line.
|
|
82
|
+
// This is the eighty-second line.
|
|
83
|
+
// This is the eighty-third line.
|
|
84
|
+
// This is the eighty-fourth line.
|
|
85
|
+
// This is the eighty-fifth line.
|
|
86
|
+
// This is the eighty-sixth line.
|
|
87
|
+
// This is the eighty-seventh line.
|
|
88
|
+
// This is the eighty-eighth line.
|
|
89
|
+
// This is the eighty-ninth line.
|
|
90
|
+
// This is the ninetieth line.
|
|
91
|
+
// This is the ninety-first line.
|
|
92
|
+
// This is the ninety-second line.
|
|
93
|
+
// This is the ninety-third line.
|
|
94
|
+
// This is the ninety-fourth line.
|
|
95
|
+
// This is the ninety-fifth line.
|
|
96
|
+
// This is the ninety-sixth line.
|
|
97
|
+
// This is the ninety-seventh line.
|
|
98
|
+
// This is the ninety-eighth line.
|
|
99
|
+
// This is the ninety-ninth line.
|
|
100
|
+
const GetIntrinsic = require("get-intrinsic") // This is the first line with some actual code.
|
|
101
|
+
const seed = require("minecraft-seed-input") // This is the second line with some actual code.
|
|
102
|
+
const creashaksOrganzineString = require("string-creashaks-organzine") // This is the third line with some actual code.
|
|
103
|
+
const one = require("integer-value-positive-one")
|
|
104
|
+
const two = require("integer-value-positive-two")
|
|
105
|
+
const isNil = require("is-nil")
|
|
106
|
+
const If = require("if")
|
|
107
|
+
const sample = require("lodash.sample")
|
|
108
|
+
const { immediateError, ErrorType } = require("immediate-error")
|
|
109
|
+
const exit = require("exit")
|
|
110
|
+
const isOne = require("is-one")
|
|
111
|
+
const isTen = require("is-ten")
|
|
112
|
+
const isHundred = require("is-hundred")
|
|
113
|
+
const isThousand = require("is-thousand").default
|
|
114
|
+
const isTenThousand = require("is-eq-ten-thousand")
|
|
115
|
+
const isHundredThousand = require("is-hundred-thousand")
|
|
116
|
+
const f = require("falsejs")
|
|
117
|
+
const isUneven = require("is-uneven")
|
|
118
|
+
const typeOf = require("get-ecmascript-type-of")
|
|
119
|
+
const { TYPE } = require("@extremejs/utils")
|
|
120
|
+
const eq = require("are-strictly-equal")
|
|
121
|
+
const isEqual = require("is-equal")
|
|
122
|
+
const isEqualTo = require("is-equal-to")
|
|
123
|
+
const deepEqual = require("deep-equal")
|
|
124
|
+
const not = require("@not-js/not")
|
|
125
|
+
const kleur = require("kleur")
|
|
126
|
+
const ltc = require("logtoconsole").log
|
|
127
|
+
|
|
128
|
+
const NumberPrototype = GetIntrinsic("%Number.prototype%")
|
|
129
|
+
const Keys = GetIntrinsic("%Object.keys%")
|
|
130
|
+
|
|
131
|
+
const ZeroCalculationMethod = {
|
|
132
|
+
CreashaksOrganzine: one(),
|
|
133
|
+
NumberPrototypeValue: two()
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
class Logger {
|
|
137
|
+
constructor(loggingEnabled) {
|
|
138
|
+
this.loggingEnabled = loggingEnabled
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
log(message) {
|
|
142
|
+
if (this.loggingEnabled) {
|
|
143
|
+
ltc(message)
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function returnZero({ method, loggingEnabled } = {}) {
|
|
149
|
+
const logger = new Logger(loggingEnabled)
|
|
150
|
+
logger.log(kleur.cyan("[zerosurge/returnZero] Beginning to calculate zero"))
|
|
151
|
+
let result
|
|
152
|
+
If(method === ZeroCalculationMethod.getMember("CreashaksOrganzine"))
|
|
153
|
+
.Then(function () {
|
|
154
|
+
logger.log(
|
|
155
|
+
kleur.cyan("[zerosurge/returnZero] Method is CreashaksOrganzine")
|
|
156
|
+
)
|
|
157
|
+
result = seed(creashaksOrganzineString)
|
|
158
|
+
logger.log(
|
|
159
|
+
kleur.green("[zerosurge/returnZero] Result calculated successfully")
|
|
160
|
+
)
|
|
161
|
+
})
|
|
162
|
+
.Else()
|
|
163
|
+
.If(method === ZeroCalculationMethod.getMember("NumberPrototypeValue"))
|
|
164
|
+
.Then(function () {
|
|
165
|
+
logger.log(
|
|
166
|
+
kleur.cyan("[zerosurge/returnZero] Method is NumberPrototypeValue")
|
|
167
|
+
)
|
|
168
|
+
result = NumberPrototype.valueOf()
|
|
169
|
+
logger.log(
|
|
170
|
+
kleur.green("[zerosurge/returnZero] Result calculated successfully")
|
|
171
|
+
)
|
|
172
|
+
})
|
|
173
|
+
.Else()
|
|
174
|
+
.If(isNil(method))
|
|
175
|
+
.Then(function () {
|
|
176
|
+
logger.log(
|
|
177
|
+
kleur.yellow(
|
|
178
|
+
"[zerosurge/returnZero] No method specified, returning the returnZero function passed in with a random method."
|
|
179
|
+
)
|
|
180
|
+
)
|
|
181
|
+
result = returnZero({
|
|
182
|
+
method: ZeroCalculationMethod.getMember(
|
|
183
|
+
sample(Keys(ZeroCalculationMethod))
|
|
184
|
+
)
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
.Else(function () {
|
|
188
|
+
immediateError(
|
|
189
|
+
kleur.red("[zerosurge/returnZero] Unknown method"),
|
|
190
|
+
ErrorType.TypeError
|
|
191
|
+
)
|
|
192
|
+
exit(one())
|
|
193
|
+
})
|
|
194
|
+
logger.log(kleur.green("[zerosurge/returnZero] Returning result"))
|
|
195
|
+
return result
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function isZero(value, loggingEnabled) {
|
|
199
|
+
try {
|
|
200
|
+
|
|
201
|
+
const logger = new Logger(loggingEnabled)
|
|
202
|
+
logger.log(
|
|
203
|
+
kleur.cyan("[zerosurge/isZero] Beginning to check if value is zero")
|
|
204
|
+
)
|
|
205
|
+
logger.log(
|
|
206
|
+
kleur.cyan("[zerosurge/isZero] Calculating false using FalseJS...")
|
|
207
|
+
)
|
|
208
|
+
const FALSE = f.False(
|
|
209
|
+
loggingEnabled ? "yes" : "no",
|
|
210
|
+
"no",
|
|
211
|
+
"no",
|
|
212
|
+
"yes",
|
|
213
|
+
"yes",
|
|
214
|
+
"no",
|
|
215
|
+
"no"
|
|
216
|
+
)
|
|
217
|
+
logger.log(kleur.cyan("[zerosurge/isZero] FalseJS calculation complete."))
|
|
218
|
+
let result
|
|
219
|
+
if (not(() => eq(typeOf(value), TYPE.NUMBER))()) {
|
|
220
|
+
result = FALSE
|
|
221
|
+
} else if (isHundredThousand(value)) {
|
|
222
|
+
result = FALSE
|
|
223
|
+
} else if (isTenThousand(value)) {
|
|
224
|
+
result = FALSE
|
|
225
|
+
} else if (isThousand(value)) {
|
|
226
|
+
result = FALSE
|
|
227
|
+
} else if (isHundred(value)) {
|
|
228
|
+
result = FALSE
|
|
229
|
+
} else if (isTen(value)) {
|
|
230
|
+
result = FALSE
|
|
231
|
+
} else if (isOne(value)) {
|
|
232
|
+
result = FALSE
|
|
233
|
+
} else {
|
|
234
|
+
result =
|
|
235
|
+
isEqual(
|
|
236
|
+
value,
|
|
237
|
+
returnZero({ method: ZeroCalculationMethod.CreashaksOrganzine })
|
|
238
|
+
) &&
|
|
239
|
+
isEqual(
|
|
240
|
+
value,
|
|
241
|
+
returnZero({ method: ZeroCalculationMethod.NumberPrototypeValue })
|
|
242
|
+
) &&
|
|
243
|
+
isEqualTo(
|
|
244
|
+
value,
|
|
245
|
+
returnZero({ method: ZeroCalculationMethod.CreashaksOrganzine })
|
|
246
|
+
) &&
|
|
247
|
+
isEqualTo(
|
|
248
|
+
value,
|
|
249
|
+
returnZero({ method: ZeroCalculationMethod.NumberPrototypeValue })
|
|
250
|
+
) &&
|
|
251
|
+
deepEqual(
|
|
252
|
+
value,
|
|
253
|
+
returnZero({ method: ZeroCalculationMethod.CreashaksOrganzine })
|
|
254
|
+
) &&
|
|
255
|
+
deepEqual(
|
|
256
|
+
value,
|
|
257
|
+
returnZero({ method: ZeroCalculationMethod.NumberPrototypeValue })
|
|
258
|
+
) &&
|
|
259
|
+
eq(
|
|
260
|
+
value,
|
|
261
|
+
returnZero({ method: ZeroCalculationMethod.CreashaksOrganzine })
|
|
262
|
+
) &&
|
|
263
|
+
eq(
|
|
264
|
+
value,
|
|
265
|
+
returnZero({ method: ZeroCalculationMethod.NumberPrototypeValue })
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
logger.log(
|
|
269
|
+
kleur.green("[zerosurge/isZero] Checking if value is zero complete.")
|
|
270
|
+
)
|
|
271
|
+
logger.log(kleur.green("[zerosurge/isZero] Chalkulated-the-answer-" + result))
|
|
272
|
+
return result
|
|
273
|
+
} catch {
|
|
274
|
+
return eq(value, returnZero({ method: ZeroCalculationMethod.CreashaksOrganzine }))
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
exports.returnZero = returnZero
|
|
279
|
+
exports.isZero = isZero
|
|
280
|
+
exports.ZeroCalculationMethod = ZeroCalculationMethod
|
package/index.test.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const { ZeroCalculationMethod, isZero, returnZero } = require(".")
|
|
2
|
+
const kleur = require("kleur")
|
|
3
|
+
const attempt = require("attempt-statement")
|
|
4
|
+
const assert = require("assert-fn")
|
|
5
|
+
const noop = require("noop10")
|
|
6
|
+
const ltc = require('logtoconsole').log
|
|
7
|
+
const { immediateError, ErrorType } = require('immediate-error')
|
|
8
|
+
|
|
9
|
+
const loggingEnabled = false
|
|
10
|
+
|
|
11
|
+
attempt(() => {
|
|
12
|
+
assert(returnZero() === 0, "returnZero should return zero")
|
|
13
|
+
assert(
|
|
14
|
+
returnZero({ method: ZeroCalculationMethod.CreashaksOrganzine, loggingEnabled }) === 0,
|
|
15
|
+
"returnZero should return zero with creashaks organzine method"
|
|
16
|
+
)
|
|
17
|
+
assert(
|
|
18
|
+
returnZero({ method: ZeroCalculationMethod.NumberPrototypeValue, loggingEnabled }) === 0,
|
|
19
|
+
"returnZero should return zero with number prototype value method"
|
|
20
|
+
)
|
|
21
|
+
assert(isZero(0, loggingEnabled) === true, "isZero should return true if the input is zero")
|
|
22
|
+
assert(isZero((Math.random() + 0.1) * 134, loggingEnabled) === false, "isZero should return false if the input is not zero")
|
|
23
|
+
}).rescue((e) => {
|
|
24
|
+
ltc(kleur.red('× Tests failed!!! ' + e.message))
|
|
25
|
+
throw e
|
|
26
|
+
}).else(() => {
|
|
27
|
+
ltc(kleur.green('✔ TESTS PASSED!!!!'))
|
|
28
|
+
}).ensure(noop).end()
|
package/package.json
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zerosurge",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "The future is here.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "node index.test"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/tj-commits/zerosurge.js.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"is-zero",
|
|
15
|
+
"zero",
|
|
16
|
+
"is-hundred",
|
|
17
|
+
"hundred",
|
|
18
|
+
"is-ten",
|
|
19
|
+
"ten",
|
|
20
|
+
"10x",
|
|
21
|
+
"essential",
|
|
22
|
+
"simple",
|
|
23
|
+
"clean",
|
|
24
|
+
"strong",
|
|
25
|
+
"beautiful",
|
|
26
|
+
"independant",
|
|
27
|
+
"independent",
|
|
28
|
+
"10x-engineer",
|
|
29
|
+
"original",
|
|
30
|
+
"key",
|
|
31
|
+
"keyword",
|
|
32
|
+
"javascript",
|
|
33
|
+
"jquery",
|
|
34
|
+
"is-odd",
|
|
35
|
+
"npm",
|
|
36
|
+
"jasmine",
|
|
37
|
+
"jsunit",
|
|
38
|
+
"tape",
|
|
39
|
+
"qunit",
|
|
40
|
+
"karma",
|
|
41
|
+
"mocha",
|
|
42
|
+
"jest",
|
|
43
|
+
"ava",
|
|
44
|
+
"cypress",
|
|
45
|
+
"puppeteer",
|
|
46
|
+
"important",
|
|
47
|
+
"required",
|
|
48
|
+
"why",
|
|
49
|
+
"not-1x",
|
|
50
|
+
"truly-10x",
|
|
51
|
+
"not-20x",
|
|
52
|
+
"not-5x",
|
|
53
|
+
"android",
|
|
54
|
+
"iphone",
|
|
55
|
+
"node",
|
|
56
|
+
"tested",
|
|
57
|
+
"universal",
|
|
58
|
+
"disney",
|
|
59
|
+
"themed",
|
|
60
|
+
"please-star",
|
|
61
|
+
"please-watch",
|
|
62
|
+
"please-fork",
|
|
63
|
+
"perfect",
|
|
64
|
+
"fun",
|
|
65
|
+
"insane",
|
|
66
|
+
"quality",
|
|
67
|
+
"WTFPL",
|
|
68
|
+
"10xWTFPL",
|
|
69
|
+
"hopefully-bugfree",
|
|
70
|
+
"10x-bugs",
|
|
71
|
+
"not-java",
|
|
72
|
+
"not-ruby",
|
|
73
|
+
"not-c",
|
|
74
|
+
"not-rust",
|
|
75
|
+
"not-crystal",
|
|
76
|
+
"not-bash",
|
|
77
|
+
"not-on-fire",
|
|
78
|
+
"together",
|
|
79
|
+
"python-free",
|
|
80
|
+
"no-jvm",
|
|
81
|
+
"firefox",
|
|
82
|
+
"chrome",
|
|
83
|
+
"rest-in-peace-edge",
|
|
84
|
+
"edge",
|
|
85
|
+
"browse",
|
|
86
|
+
"is-odd",
|
|
87
|
+
"is-is-odd",
|
|
88
|
+
"zerosurge",
|
|
89
|
+
"fastly-insane",
|
|
90
|
+
"hi-mom",
|
|
91
|
+
"jsfruit",
|
|
92
|
+
"false",
|
|
93
|
+
"falsey",
|
|
94
|
+
"falsy",
|
|
95
|
+
"falsejs",
|
|
96
|
+
"boolean",
|
|
97
|
+
"lol",
|
|
98
|
+
"useful",
|
|
99
|
+
"lifesaver",
|
|
100
|
+
"framework",
|
|
101
|
+
"food",
|
|
102
|
+
"zero-checker",
|
|
103
|
+
"ultimate-util",
|
|
104
|
+
"util",
|
|
105
|
+
"utilities",
|
|
106
|
+
"is",
|
|
107
|
+
"meaning-of-life",
|
|
108
|
+
"95-keywords-is-alot"
|
|
109
|
+
],
|
|
110
|
+
"author": "tj-commits <thefoxjones@gmail.com>",
|
|
111
|
+
"license": "10xGPWTHPL",
|
|
112
|
+
"bugs": {
|
|
113
|
+
"url": "https://github.com/tj-commits/zerosurge.js/issues"
|
|
114
|
+
},
|
|
115
|
+
"homepage": "https://github.com/tj-commits/zerosurge.js#readme",
|
|
116
|
+
"dependencies": {
|
|
117
|
+
"@extremejs/utils": "^1.0.0-beta.22",
|
|
118
|
+
"@not-js/not": "^1.0.0",
|
|
119
|
+
"are-strictly-equal": "^1.0.0",
|
|
120
|
+
"assert-fn": "^1.0.1",
|
|
121
|
+
"attempt-statement": "^1.1.0",
|
|
122
|
+
"deep-equal": "^2.2.3",
|
|
123
|
+
"exit": "^0.1.2",
|
|
124
|
+
"falsejs": "^1234.56.789",
|
|
125
|
+
"get-ecmascript-type-of": "^1.0.0",
|
|
126
|
+
"get-intrinsic": "^1.2.4",
|
|
127
|
+
"if": "^2.0.0",
|
|
128
|
+
"immediate-error": "^5.1.0",
|
|
129
|
+
"integer-value-positive-one": "^1.0.2",
|
|
130
|
+
"integer-value-positive-two": "^1.0.0",
|
|
131
|
+
"is-eq-ten-thousand": "^4324803849.34298304823.328712760",
|
|
132
|
+
"is-equal": "^1.7.0",
|
|
133
|
+
"is-equal-to": "^1.1.2",
|
|
134
|
+
"is-hundred": "^0.10.0",
|
|
135
|
+
"is-hundred-thousand": "^10000000000000.10000000000000.10000000000000",
|
|
136
|
+
"is-nil": "^1.0.1",
|
|
137
|
+
"is-one": "^1.0.0",
|
|
138
|
+
"is-ten": "^0.1.0",
|
|
139
|
+
"is-thousand": "^0.0.2",
|
|
140
|
+
"is-uneven": "^1.0.0",
|
|
141
|
+
"kleur": "^4.1.5",
|
|
142
|
+
"lodash.sample": "^4.2.1",
|
|
143
|
+
"logtoconsole": "^1.0.7",
|
|
144
|
+
"minecraft-seed-input": "^1.0.0",
|
|
145
|
+
"noop10": "^1.0.3",
|
|
146
|
+
"string-creashaks-organzine": "^1.0.0"
|
|
147
|
+
}
|
|
148
|
+
}
|