lolite.ceil 1.1.8 → 1.1.9
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 +105 -7
- package/package.json +34 -41
- package/{add.js → src/lib/add.js} +1 -1
- package/{and.js → src/lib/and.js} +1 -1
- package/{isNumber.js → src/lib/isNumber.js} +1 -1
- package/{not.js → src/lib/not.js} +1 -1
- package/{or.js → src/lib/or.js} +1 -1
- package/{subtract.js → src/lib/subtract.js} +1 -1
- /package/{index.js → src/lib/ceil.js} +0 -0
- /package/{floor.js → src/lib/floor.js} +0 -0
- /package/{isFinite.js → src/lib/isFinite.js} +0 -0
- /package/{isFunction.js → src/lib/isFunction.js} +0 -0
- /package/{isNull.js → src/lib/isNull.js} +0 -0
- /package/{isObject.js → src/lib/isObject.js} +0 -0
- /package/{arrayOfAllBooleans.js → src/private/arrayOfAllBooleans.js} +0 -0
- /package/{crash.js → src/private/crash.js} +0 -0
- /package/{isNotInteger.js → src/private/isNotInteger.js} +0 -0
- /package/{multiplyFallback.js → src/private/multiplyFallback.js} +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
### ceil(value)
|
|
1
|
+
## ceil(value)
|
|
4
2
|
Round a number up to the nearest whole integer.
|
|
5
3
|
Non-finite or non-numeric values are coerced to zero.
|
|
6
4
|
|
|
7
5
|
```javascript
|
|
8
|
-
const
|
|
6
|
+
const lolite = require("lolite.ceil")
|
|
9
7
|
const positiveResult = ceil(2.1)
|
|
10
8
|
// result: 3
|
|
11
9
|
|
|
@@ -14,6 +12,106 @@ const negativeResult = ceil(-2.1)
|
|
|
14
12
|
|
|
15
13
|
const coercedResult = ceil("garbage")
|
|
16
14
|
// result: 0 (0 ceiled)
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
|
package/package.json
CHANGED
|
@@ -1,62 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lolite.ceil",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"author": "10x'ly Made Software Ventures AB",
|
|
3
|
+
"version": "1.1.9",
|
|
4
|
+
"main": "src/lib/ceil.js",
|
|
7
5
|
"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
6
|
"dependencies": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
7
|
+
"construct-new": "^2.0.4",
|
|
8
|
+
"while2": "^2.0.2",
|
|
9
|
+
"iszero": "^1.0.0",
|
|
10
|
+
"countingup": "^0.3.0",
|
|
11
|
+
"@10xly/strict-equals": "^1.0.0",
|
|
12
|
+
"subtract": "^0.0.3",
|
|
13
|
+
"@is-(unknown)/is-finite": "^1.0.0",
|
|
14
|
+
"pkg-with-failing-optional-dependency": "^1.0.1",
|
|
15
|
+
"@positive-numbers/zero": "^3.0.0",
|
|
16
|
+
"@positive-numbers/one": "^3.0.0",
|
|
17
|
+
"false-value": "^2.0.6",
|
|
21
18
|
"is-not-integer": "^1.0.2",
|
|
19
|
+
"immediate-error": "^7.1.0",
|
|
20
|
+
"core-js-pure": "^3.47.0",
|
|
22
21
|
"logtoconsole": "^1.0.7",
|
|
22
|
+
"lodash.multiply": "^4.9.0",
|
|
23
|
+
"integer-values": "^2.0.0",
|
|
23
24
|
"@not-js/not": "^1.1.0",
|
|
24
|
-
"es-logical-not-operator": "^1.0.0",
|
|
25
25
|
"is-integer": "^1.0.7",
|
|
26
|
-
"
|
|
26
|
+
"es-logical-not-operator": "^1.0.0",
|
|
27
27
|
"not-not": "^1.0.2",
|
|
28
28
|
"yanoop": "^1.0.0",
|
|
29
|
-
"
|
|
30
|
-
"@positive-numbers/one": "^3.0.0",
|
|
31
|
-
"@positive-numbers/zero": "^3.0.0",
|
|
32
|
-
"construct-new": "^2.0.4",
|
|
33
|
-
"countingup": "^0.3.0",
|
|
34
|
-
"false-value": "^2.0.6",
|
|
35
|
-
"iszero": "^1.0.0",
|
|
36
|
-
"pkg-with-failing-optional-dependency": "^1.0.1",
|
|
37
|
-
"subtract": "^0.0.3",
|
|
38
|
-
"while2": "^2.0.2",
|
|
39
|
-
"es-intrinsic-cache": "^1.0.1",
|
|
29
|
+
"literally": "^1.0.0",
|
|
40
30
|
"is-not-negative": "^1.0.3",
|
|
41
31
|
"string-split": "^0.3.1",
|
|
42
32
|
"to-str": "^1.0.0",
|
|
33
|
+
"es-intrinsic-cache": "^1.0.1",
|
|
34
|
+
"get-intrinsic": "^1.3.1",
|
|
35
|
+
"add-two-numbers2": "^1.0.0",
|
|
36
|
+
"array-includes": "^3.1.9",
|
|
37
|
+
"object.values": "^1.2.1",
|
|
38
|
+
"map-values": "^1.0.1",
|
|
43
39
|
"true-value": "^2.0.5",
|
|
40
|
+
"for-each": "^0.3.5",
|
|
41
|
+
"important-extremely-useful-classes": "^3.1.0",
|
|
42
|
+
"es-logical-or-operator": "^1.0.0",
|
|
43
|
+
"@is-(unknown)/is-true": "^1.5.0",
|
|
44
|
+
"@is-(unknown)/is-false": "^1.5.0",
|
|
44
45
|
"array-filter": "^1.0.0",
|
|
45
|
-
"
|
|
46
|
+
"is-positive": "^3.1.0",
|
|
46
47
|
"es-typeof": "^1.0.0",
|
|
47
|
-
"
|
|
48
|
+
"@extremejs/utils": "^1.0.0-beta.22",
|
|
49
|
+
"hasown": "^2.0.2",
|
|
48
50
|
"has-symbol-support-x": "^1.4.2",
|
|
49
51
|
"has-tostringtag": "^1.0.2",
|
|
50
|
-
"hasown": "^2.0.2",
|
|
51
52
|
"es-object-atoms": "^1.1.1",
|
|
52
|
-
"
|
|
53
|
-
"es-logical-or-operator": "^1.0.0",
|
|
54
|
-
"for-each": "^0.3.5",
|
|
55
|
-
"important-extremely-useful-classes": "^3.1.0",
|
|
56
|
-
"infinities": "^1.0.1",
|
|
57
|
-
"is-positive": "^3.1.0",
|
|
58
|
-
"map-values": "^1.0.1",
|
|
59
|
-
"object.values": "^1.2.1",
|
|
60
|
-
"add-two-numbers2": "^1.0.0"
|
|
53
|
+
"infinities": "^1.0.1"
|
|
61
54
|
}
|
|
62
55
|
}
|
|
@@ -18,7 +18,7 @@ const number0 = require("@positive-numbers/zero")
|
|
|
18
18
|
const number1 = require("@positive-numbers/one")
|
|
19
19
|
const falseValue = require("false-value")
|
|
20
20
|
|
|
21
|
-
const isNotInteger = require("
|
|
21
|
+
const isNotInteger = require("../private/isNotInteger")
|
|
22
22
|
|
|
23
23
|
function add(augend, addend) {
|
|
24
24
|
// eslint-disable-next-line no-underscore-dangle
|
|
@@ -11,7 +11,7 @@ const {
|
|
|
11
11
|
} = require("important-extremely-useful-classes")
|
|
12
12
|
const construct = require("construct-new")
|
|
13
13
|
// eslint-disable-next-line camelcase
|
|
14
|
-
const crash_program = require("
|
|
14
|
+
const crash_program = require("../private/crash")
|
|
15
15
|
const equal = require("@10xly/strict-equals"),
|
|
16
16
|
notEqual = require("@not-js/not")(equal)
|
|
17
17
|
// eslint-disable-next-line sonarjs/no-globals-shadowing
|
|
@@ -2,7 +2,7 @@ const isTrue = require("@is-(unknown)/is-true")
|
|
|
2
2
|
const isFalse = require("@is-(unknown)/is-false")
|
|
3
3
|
const arrayFilter = require("array-filter")
|
|
4
4
|
const trueValue = require("true-value")
|
|
5
|
-
const possibilities = require("
|
|
5
|
+
const possibilities = require("../private/arrayOfAllBooleans")
|
|
6
6
|
|
|
7
7
|
function not(value) {
|
|
8
8
|
const result = arrayFilter(possibilities, (maybe) => {
|
package/{or.js → src/lib/or.js}
RENAMED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
const not = require("./not")
|
|
6
6
|
const and = require("./and")
|
|
7
7
|
// eslint-disable-next-line camelcase
|
|
8
|
-
const crash_program = require("
|
|
8
|
+
const crash_program = require("../private/crash")
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line init-declarations, no-unassigned-vars
|
|
11
11
|
let cdefghijklmnopqrstuvwxyz
|
|
@@ -13,7 +13,7 @@ const number1 = require("@positive-numbers/one")
|
|
|
13
13
|
const falseValue = require("false-value"),
|
|
14
14
|
{ Counter } = countingup
|
|
15
15
|
|
|
16
|
-
const isNotInteger = require("
|
|
16
|
+
const isNotInteger = require("../private/isNotInteger")
|
|
17
17
|
|
|
18
18
|
function subtract(minuend, subtrahend) {
|
|
19
19
|
if (equal(isFinite(minuend), falseValue())) {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|