lolite.abs 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.
Files changed (2) hide show
  1. package/README.md +0 -153
  2. package/package.json +6 -1
package/README.md CHANGED
@@ -10,157 +10,4 @@ const result = abs(-42)
10
10
  const coercedAbs = abs("garbage")
11
11
  // result: 0
12
12
  ```
13
-
14
- ### invert(value)
15
- Inverts the sign of a value. Zero becomes negative zero.
16
- Non-numeric values are coerced to zero.
17
- Infinity is negated to -Infinity, and vice versa.
18
-
19
- ```javascript
20
- const lolite = require("lolite.abs")
21
- const inverted = lolite.invert(10)
22
- // inverted: -10
23
-
24
- const doubleNegative = lolite.invert(-5)
25
- // result: 5
26
-
27
- const negativeInfinity = lolite.invert(Infinity)
28
- // result: -Infinity
29
-
30
- const coercedNegative = lolite.invert("garbage")
31
- // result: -0 (0 inverted)
32
- ```
33
-
34
- ### floor(value)
35
- Round a number down to the nearest whole integer.
36
- Non-finite or non-numeric values are coerced to zero.
37
-
38
- ```javascript
39
- const lolite = require("lolite.abs")
40
- const positiveResult = lolite.floor(2.1)
41
- // result: 2
42
-
43
- const negativeResult = lolite.floor(-2.1)
44
- // result: 3
45
-
46
- const coercedResult = lolite.floor("garbage")
47
- // result: 0 (0 floored)
48
- ```
49
-
50
- ### ceil(value)
51
- Round a number up to the nearest whole integer.
52
- Non-finite or non-numeric values are coerced to zero.
53
-
54
- ```javascript
55
- const lolite = require("lolite.abs")
56
- const positiveResult = lolite.ceil(2.1)
57
- // result: 3
58
-
59
- const negativeResult = lolite.ceil(-2.1)
60
- // result: 2
61
-
62
- const coercedResult = lolite.ceil("garbage")
63
- // result: 0 (0 ceiled)
64
- ```
65
-
66
- ### round(value)
67
- Round a number either up to the nearest whole integer, unless the number is less than `0.5`, then it rounds down.
68
- Non-finite or non-numeric values are coerced to zero.
69
-
70
- ```javascript
71
- const lolite = require("lolite.abs")
72
-
73
- const flooredResult = lolite.round(2.1)
74
- // result: 2
75
-
76
- const ceiledResult = lolite.round(2.9)
77
- // result: 3
78
-
79
- const coercedResult = lolite.round("garbage")
80
- // result: 0 (0 ceiled)
81
- ```
82
-
83
- ### trunc(value)
84
- Truncates the decimal portion of a number, returning only the integer part. Truncation moves toward zero for both positive and negative numbers.
85
- Non-finite or non-numeric values are coerced to zero.
86
-
87
- ```javascript
88
- const lolite = require("lolite.abs")
89
-
90
- const positiveResult = lolite.trunc(2.9)
91
- // result: 2
92
-
93
- const negativeResult = lolite.trunc(-2.9)
94
- // result: -2
95
-
96
- const zeroPreservation = lolite.trunc(-0)
97
- // result: -0
98
-
99
- const coercedResult = lolite.trunc("garbage")
100
- // result: 0
101
- ```
102
-
103
- ### sign(value)
104
- Returns the sign of a number, indicating whether the number is positive, negative, or zero, or negative zero.
105
- Non-finite values are coerced to zero.
106
-
107
- ```javascript
108
- const lolite = require("lolite.abs")
109
-
110
- lolite.sign(42) // result: 1
111
- lolite.sign(Infinity) // result: 1
112
- lolite.sign(-42) // result: -1
113
- lolite.sign(-Infinity) // result: -1
114
- lolite.sign(0) // result: 0
115
- lolite.sign(-0) // result: -0
116
-
117
- lolite.sign("garbage") // result: 0
118
- lolite.sign(NaN) // result: 0
119
- ```
120
-
121
- ### max(a, b)
122
- Returns the largest of two numbers.
123
- Non-finite or non-numeric values are coerced to zero.
124
-
125
- ```javascript
126
- const lolite = require("lolite.abs")
127
- const result = lolite.max(5, 10)
128
- // result: 10
129
-
130
- const coercedMax = lolite.max(-5, Infinity)
131
- // result: 0 (comparing -5 and 0)
132
- ```
133
-
134
- ### min(a, b)
135
- Returns the smallest of two numbers.
136
- Non-finite or non-numeric values are coerced to zero.
137
-
138
- ```javascript
139
- const lolite = require("lolite.abs")
140
- const result = lolite.min(5, 10)
141
- // result: 5
142
-
143
- const coercedMin = lolite.min(5, "garbage")
144
- // result: 0 (comparing 5 and 0)
145
- ```
146
-
147
- ### clamp(value, lower, upper)
148
- Restricts a value to be within the specified bounds.
149
- Non-finite or non-numeric values are coerced to zero.
150
-
151
- Note: If lower bound exceeds upper bound after coercion, the function prioritizes the lower bound.
152
- ```javascript
153
- const lolite = require("lolite.abs")
154
- const result = lolite.clamp(5, 1, 10)
155
- // result: 5
156
-
157
- const capped = lolite.clamp(15, 1, 10)
158
- // result: 10
159
-
160
- const raised = lolite.clamp(-5, 1, 10)
161
- // result: 1
162
-
163
- const coercedClamp = lolite.clamp(Infinity, "garbage", NaN)
164
- // result: 0 (0 clamped between 0 and 0)
165
- ```
166
13
 
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "lolite.abs",
3
- "version": "1.1.9",
3
+ "version": "1.1.13",
4
4
  "main": "src/lib/abs.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
  "pkg-with-failing-optional-dependency": "^1.0.1",
8
13
  "countingup-legacy-first-version": "npm:countingup@^0.0.1",