lolite.ceil 1.1.9 → 1.1.13
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 +0 -101
- package/package.json +10 -3
- package/src/private/crash.js +4 -3
package/README.md
CHANGED
|
@@ -13,105 +13,4 @@ const negativeResult = ceil(-2.1)
|
|
|
13
13
|
const coercedResult = ceil("garbage")
|
|
14
14
|
// result: 0 (0 ceiled)
|
|
15
15
|
```
|
|
16
|
-
|
|
17
|
-
### round(value)
|
|
18
|
-
Round a number either up to the nearest whole integer, unless the number is less than `0.5`, then it rounds down.
|
|
19
|
-
Non-finite or non-numeric values are coerced to zero.
|
|
20
|
-
|
|
21
|
-
```javascript
|
|
22
|
-
const lolite = require("lolite.ceil")
|
|
23
|
-
|
|
24
|
-
const flooredResult = lolite.round(2.1)
|
|
25
|
-
// result: 2
|
|
26
|
-
|
|
27
|
-
const ceiledResult = lolite.round(2.9)
|
|
28
|
-
// result: 3
|
|
29
|
-
|
|
30
|
-
const coercedResult = lolite.round("garbage")
|
|
31
|
-
// result: 0 (0 ceiled)
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### trunc(value)
|
|
35
|
-
Truncates the decimal portion of a number, returning only the integer part. Truncation moves toward zero for both positive and negative numbers.
|
|
36
|
-
Non-finite or non-numeric values are coerced to zero.
|
|
37
|
-
|
|
38
|
-
```javascript
|
|
39
|
-
const lolite = require("lolite.ceil")
|
|
40
|
-
|
|
41
|
-
const positiveResult = lolite.trunc(2.9)
|
|
42
|
-
// result: 2
|
|
43
|
-
|
|
44
|
-
const negativeResult = lolite.trunc(-2.9)
|
|
45
|
-
// result: -2
|
|
46
|
-
|
|
47
|
-
const zeroPreservation = lolite.trunc(-0)
|
|
48
|
-
// result: -0
|
|
49
|
-
|
|
50
|
-
const coercedResult = lolite.trunc("garbage")
|
|
51
|
-
// result: 0
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### sign(value)
|
|
55
|
-
Returns the sign of a number, indicating whether the number is positive, negative, or zero, or negative zero.
|
|
56
|
-
Non-finite values are coerced to zero.
|
|
57
|
-
|
|
58
|
-
```javascript
|
|
59
|
-
const lolite = require("lolite.ceil")
|
|
60
|
-
|
|
61
|
-
lolite.sign(42) // result: 1
|
|
62
|
-
lolite.sign(Infinity) // result: 1
|
|
63
|
-
lolite.sign(-42) // result: -1
|
|
64
|
-
lolite.sign(-Infinity) // result: -1
|
|
65
|
-
lolite.sign(0) // result: 0
|
|
66
|
-
lolite.sign(-0) // result: -0
|
|
67
|
-
|
|
68
|
-
lolite.sign("garbage") // result: 0
|
|
69
|
-
lolite.sign(NaN) // result: 0
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### max(a, b)
|
|
73
|
-
Returns the largest of two numbers.
|
|
74
|
-
Non-finite or non-numeric values are coerced to zero.
|
|
75
|
-
|
|
76
|
-
```javascript
|
|
77
|
-
const lolite = require("lolite.ceil")
|
|
78
|
-
const result = lolite.max(5, 10)
|
|
79
|
-
// result: 10
|
|
80
|
-
|
|
81
|
-
const coercedMax = lolite.max(-5, Infinity)
|
|
82
|
-
// result: 0 (comparing -5 and 0)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### min(a, b)
|
|
86
|
-
Returns the smallest of two numbers.
|
|
87
|
-
Non-finite or non-numeric values are coerced to zero.
|
|
88
|
-
|
|
89
|
-
```javascript
|
|
90
|
-
const lolite = require("lolite.ceil")
|
|
91
|
-
const result = lolite.min(5, 10)
|
|
92
|
-
// result: 5
|
|
93
|
-
|
|
94
|
-
const coercedMin = lolite.min(5, "garbage")
|
|
95
|
-
// result: 0 (comparing 5 and 0)
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### clamp(value, lower, upper)
|
|
99
|
-
Restricts a value to be within the specified bounds.
|
|
100
|
-
Non-finite or non-numeric values are coerced to zero.
|
|
101
|
-
|
|
102
|
-
Note: If lower bound exceeds upper bound after coercion, the function prioritizes the lower bound.
|
|
103
|
-
```javascript
|
|
104
|
-
const lolite = require("lolite.ceil")
|
|
105
|
-
const result = lolite.clamp(5, 1, 10)
|
|
106
|
-
// result: 5
|
|
107
|
-
|
|
108
|
-
const capped = lolite.clamp(15, 1, 10)
|
|
109
|
-
// result: 10
|
|
110
|
-
|
|
111
|
-
const raised = lolite.clamp(-5, 1, 10)
|
|
112
|
-
// result: 1
|
|
113
|
-
|
|
114
|
-
const coercedClamp = lolite.clamp(Infinity, "garbage", NaN)
|
|
115
|
-
// result: 0 (0 clamped between 0 and 0)
|
|
116
|
-
```
|
|
117
16
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lolite.ceil",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"main": "src/lib/ceil.js",
|
|
5
5
|
"license": "EGPSL10X-1.0",
|
|
6
|
+
"author": "10x'ly Made Software Ventures AB",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/enterprise-npm-ai/lolite.git"
|
|
10
|
+
},
|
|
6
11
|
"dependencies": {
|
|
7
12
|
"construct-new": "^2.0.4",
|
|
8
13
|
"while2": "^2.0.2",
|
|
@@ -16,11 +21,13 @@
|
|
|
16
21
|
"@positive-numbers/one": "^3.0.0",
|
|
17
22
|
"false-value": "^2.0.6",
|
|
18
23
|
"is-not-integer": "^1.0.2",
|
|
19
|
-
"immediate-error": "^
|
|
20
|
-
"
|
|
24
|
+
"immediate-error": "^11.0.1",
|
|
25
|
+
"setTimeout": "^0.4.9",
|
|
21
26
|
"logtoconsole": "^1.0.7",
|
|
22
27
|
"lodash.multiply": "^4.9.0",
|
|
23
28
|
"integer-values": "^2.0.0",
|
|
29
|
+
"fizzbuzz-enterprise": "^1.0.0",
|
|
30
|
+
"@rightpad/concat": "^1.0.0",
|
|
24
31
|
"@not-js/not": "^1.1.0",
|
|
25
32
|
"is-integer": "^1.0.7",
|
|
26
33
|
"es-logical-not-operator": "^1.0.0",
|
package/src/private/crash.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
const createcrashdump = require("is-not-integer")
|
|
2
2
|
const { ErrorType, immediateError } = require("immediate-error")
|
|
3
|
-
|
|
4
|
-
const setTimeout = require("core-js-pure/actual/set-timeout")
|
|
3
|
+
const setTimeout = require("setTimeout")
|
|
5
4
|
const { log } = require("logtoconsole")
|
|
6
5
|
const multiply = require("./multiplyFallback")
|
|
7
6
|
const { positiveFive, positiveOneHundred, positiveTwo } = require("integer-values")
|
|
7
|
+
const newline = require("fizzbuzz-enterprise/source/main/constants/strings/delimiters/Newline")
|
|
8
|
+
const concat = require("@rightpad/concat")
|
|
8
9
|
|
|
9
10
|
// eslint-disable-next-line camelcase
|
|
10
11
|
function crash_program() {
|
|
11
|
-
log("[lolite] SOMETHING WENT WRONG,
|
|
12
|
+
log(concat("[lolite] SOMETHING WENT WRONG, PROGRAM IS ABOUT TO CRASH, A CRASH DUMP FILE WILL PROBABLY BE GENERATED", newline, "~ PLEASE FILE ISSUE ON GITHUB REPO: ", newline, "https://github.com/enterprise-npm-ai/lolite"))
|
|
12
13
|
setTimeout(() => {
|
|
13
14
|
createcrashdump()
|
|
14
15
|
setTimeout(() => {
|