uom-types 5.0.0 → 5.1.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/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file. Dates are displayed in UTC.
3
3
 
4
+ # [5.1.0](https://github.com/RebeccaStevens/uom-types/compare/v5.0.1...v5.1.0) (2026-03-04)
5
+
6
+
7
+ ### Features
8
+
9
+ * expose more entry points ([#436](https://github.com/RebeccaStevens/uom-types/issues/436)) ([ccc4be9](https://github.com/RebeccaStevens/uom-types/commit/ccc4be9fc97d7a176b261547a132023cc4ec3736))
10
+
11
+ ## [5.0.1](https://github.com/RebeccaStevens/uom-types/compare/v5.0.0...v5.0.1) (2024-12-14)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * dist types ([a01ca42](https://github.com/RebeccaStevens/uom-types/commit/a01ca429263a5752edf554a739318cdeb155a940)), closes [#437](https://github.com/RebeccaStevens/uom-types/issues/437)
17
+
4
18
  # [5.0.0](https://github.com/RebeccaStevens/uom-types/compare/v4.1.2...v5.0.0) (2024-11-27)
5
19
 
6
20
 
@@ -0,0 +1,252 @@
1
+ function add(...args) {
2
+ return args.length === 1 ? (a) => a + args[0] : args[0] + args[1];
3
+ }
4
+ function sub(...args) {
5
+ return args.length === 1 ? (a) => a - args[0] : args[0] - args[1];
6
+ }
7
+ function mul(...args) {
8
+ return args.length === 1 ? (a) => a * args[0] : args[0] * args[1];
9
+ }
10
+ function div(...args) {
11
+ return args.length === 1 ? (a) => a / args[0] : args[0] / args[1];
12
+ }
13
+ function mod(...args) {
14
+ return args.length === 1 ? (a) => a % args[0] : args[0] % args[1];
15
+ }
16
+ function modSafe(...args) {
17
+ return args.length === 1
18
+ ? (a) => ((a % args[0]) + args[0]) % args[0]
19
+ : ((args[0] % args[1]) + args[1]) % args[1];
20
+ }
21
+ function pow(...args) {
22
+ return args.length === 1 ? (b) => b ** args[0] : args[0] ** args[1];
23
+ }
24
+ function root(...args) {
25
+ return args.length === 1 ? (b) => b ** (1 / args[0]) : args[0] ** (1 / args[1]);
26
+ }
27
+ /**
28
+ * Take the square root of the given value.
29
+ *
30
+ * @category Math
31
+ * @returns `value ** (1/2)`
32
+ */
33
+ function sqrt(value) {
34
+ return root(value, 2);
35
+ }
36
+ /**
37
+ * Inverse the given value.
38
+ *
39
+ * @category Math
40
+ * @returns `value ** -1`
41
+ */
42
+ function inverse(value) {
43
+ return pow(value, -1);
44
+ }
45
+ /**
46
+ * Returns the negative of the given value.
47
+ *
48
+ * @category Math
49
+ * @returns `-value`
50
+ */
51
+ function negate(value) {
52
+ return -value;
53
+ }
54
+ /**
55
+ * Returns the absolute value of the given value.
56
+ *
57
+ * @category Math
58
+ * @returns `Math.abs(value)`
59
+ */
60
+ function abs(value) {
61
+ return Math.abs(value);
62
+ }
63
+ /**
64
+ * Returns the greatest integer less than or equal to the given value.
65
+ *
66
+ * @category Math
67
+ * @returns `Math.floor(value)`
68
+ */
69
+ function floor(value) {
70
+ return Math.floor(value);
71
+ }
72
+ /**
73
+ * Returns the smallest integer greater than or equal the given value.
74
+ *
75
+ * @category Math
76
+ * @returns `Math.ceil(value)`
77
+ */
78
+ function ceil(value) {
79
+ return Math.ceil(value);
80
+ }
81
+ /**
82
+ * Returns the given value rounded to the nearest integer.
83
+ *
84
+ * @category Math
85
+ * @returns `Math.round(value)`
86
+ */
87
+ function round(value) {
88
+ return Math.round(value);
89
+ }
90
+ /**
91
+ * Returns the larger value in the given collection.
92
+ *
93
+ * @category Math
94
+ * @returns `Math.max(values)`
95
+ */
96
+ function max(values) {
97
+ return Math.max(...values);
98
+ }
99
+ /**
100
+ * Returns the smallest value in the given collection.
101
+ *
102
+ * @category Math
103
+ * @returns `Math.min(values)`
104
+ */
105
+ function min(values) {
106
+ return Math.min(...values);
107
+ }
108
+ /**
109
+ * Takes the sum of all the values in the given collection.
110
+ *
111
+ * @category Math
112
+ * @returns `Math.sum(values)`
113
+ */
114
+ function sum(values) {
115
+ return [...values].reduce(add, 0);
116
+ }
117
+ function eq(...args) {
118
+ return args.length === 1 ? (a) => a === args[0] : args[0] === args[1];
119
+ }
120
+ function gt(...args) {
121
+ return args.length === 1 ? (a) => a > args[0] : args[0] > args[1];
122
+ }
123
+ function gte(...args) {
124
+ return args.length === 1 ? (a) => a >= args[0] : args[0] >= args[1];
125
+ }
126
+ function lt(...args) {
127
+ return args.length === 1 ? (a) => a < args[0] : args[0] < args[1];
128
+ }
129
+ function lte(...args) {
130
+ return args.length === 1 ? (a) => a <= args[0] : args[0] <= args[1];
131
+ }
132
+ /**
133
+ * Returns the sine of a number.
134
+ *
135
+ * @category Math
136
+ * @returns `Math.sin(angle)`
137
+ */
138
+ function sin(angle) {
139
+ return Math.sin(angle);
140
+ }
141
+ /**
142
+ * Returns the cosine of a number.
143
+ *
144
+ * @category Math
145
+ * @returns `Math.cos(angle)`
146
+ */
147
+ function cos(angle) {
148
+ return Math.cos(angle);
149
+ }
150
+ /**
151
+ * Returns the tangent of a number.
152
+ *
153
+ * @category Math
154
+ * @returns `Math.tan(angle)`
155
+ */
156
+ function tan(angle) {
157
+ return Math.tan(angle);
158
+ }
159
+ /**
160
+ * Returns the arcsine of a number.
161
+ *
162
+ * @category Math
163
+ * @returns `Math.asin(value)`
164
+ */
165
+ function asin(value) {
166
+ return Math.asin(value);
167
+ }
168
+ /**
169
+ * Returns the arc cosine (or inverse cosine) of a number.
170
+ *
171
+ * @category Math
172
+ * @returns `Math.acos(value)`
173
+ */
174
+ function acos(value) {
175
+ return Math.acos(value);
176
+ }
177
+ /**
178
+ * Returns the arctangent of a number.
179
+ *
180
+ * @category Math
181
+ * @returns `Math.atan(value)`
182
+ */
183
+ function atan(value) {
184
+ return Math.atan(value);
185
+ }
186
+ /**
187
+ * Returns the angle (in radians) from the X axis to a point.
188
+ *
189
+ * @category Math
190
+ * @param x - A number representing the cartesian x-coordinate.
191
+ * @param y - A number representing the cartesian y-coordinate.
192
+ * @returns `Math.atan2(x, y)`
193
+ */
194
+ function atan2(x, y) {
195
+ return Math.atan2(x, y);
196
+ }
197
+ /**
198
+ * Returns the hyperbolic sine of a number.
199
+ *
200
+ * @category Math
201
+ * @returns `Math.sinh(angle)`
202
+ */
203
+ function sinh(angle) {
204
+ return Math.sinh(angle);
205
+ }
206
+ /**
207
+ * Returns the hyperbolic cosine of a number.
208
+ *
209
+ * @category Math
210
+ * @returns `Math.cosh(angle)`
211
+ */
212
+ function cosh(angle) {
213
+ return Math.cosh(angle);
214
+ }
215
+ /**
216
+ * Returns the hyperbolic tangent of a number.
217
+ *
218
+ * @category Math
219
+ * @returns `Math.tanh(angle)`
220
+ */
221
+ function tanh(angle) {
222
+ return Math.tanh(angle);
223
+ }
224
+ /**
225
+ * Returns the inverse hyperbolic sine of a number.
226
+ *
227
+ * @category Math
228
+ * @returns `Math.asinh(value)`
229
+ */
230
+ function asinh(value) {
231
+ return Math.asinh(value);
232
+ }
233
+ /**
234
+ * Returns the inverse hyperbolic cosine of a number.
235
+ *
236
+ * @category Math
237
+ * @returns `Math.acosh(value)`
238
+ */
239
+ function acosh(value) {
240
+ return Math.acosh(value);
241
+ }
242
+ /**
243
+ * Returns the inverse hyperbolic tangent of a number.
244
+ *
245
+ * @category Math
246
+ * @returns `Math.atanh(value)`
247
+ */
248
+ function atanh(value) {
249
+ return Math.atanh(value);
250
+ }
251
+
252
+ export { pow as A, root as B, round as C, sin as D, sinh as E, sqrt as F, sub as G, sum as H, tan as I, tanh as J, abs as a, acos as b, acosh as c, add as d, asin as e, asinh as f, atan as g, atan2 as h, atanh as i, ceil as j, cos as k, cosh as l, div as m, eq as n, floor as o, gt as p, gte as q, inverse as r, lt as s, lte as t, max as u, min as v, mod as w, modSafe as x, mul as y, negate as z };
@@ -0,0 +1,289 @@
1
+ 'use strict';
2
+
3
+ function add(...args) {
4
+ return args.length === 1 ? (a) => a + args[0] : args[0] + args[1];
5
+ }
6
+ function sub(...args) {
7
+ return args.length === 1 ? (a) => a - args[0] : args[0] - args[1];
8
+ }
9
+ function mul(...args) {
10
+ return args.length === 1 ? (a) => a * args[0] : args[0] * args[1];
11
+ }
12
+ function div(...args) {
13
+ return args.length === 1 ? (a) => a / args[0] : args[0] / args[1];
14
+ }
15
+ function mod(...args) {
16
+ return args.length === 1 ? (a) => a % args[0] : args[0] % args[1];
17
+ }
18
+ function modSafe(...args) {
19
+ return args.length === 1
20
+ ? (a) => ((a % args[0]) + args[0]) % args[0]
21
+ : ((args[0] % args[1]) + args[1]) % args[1];
22
+ }
23
+ function pow(...args) {
24
+ return args.length === 1 ? (b) => b ** args[0] : args[0] ** args[1];
25
+ }
26
+ function root(...args) {
27
+ return args.length === 1 ? (b) => b ** (1 / args[0]) : args[0] ** (1 / args[1]);
28
+ }
29
+ /**
30
+ * Take the square root of the given value.
31
+ *
32
+ * @category Math
33
+ * @returns `value ** (1/2)`
34
+ */
35
+ function sqrt(value) {
36
+ return root(value, 2);
37
+ }
38
+ /**
39
+ * Inverse the given value.
40
+ *
41
+ * @category Math
42
+ * @returns `value ** -1`
43
+ */
44
+ function inverse(value) {
45
+ return pow(value, -1);
46
+ }
47
+ /**
48
+ * Returns the negative of the given value.
49
+ *
50
+ * @category Math
51
+ * @returns `-value`
52
+ */
53
+ function negate(value) {
54
+ return -value;
55
+ }
56
+ /**
57
+ * Returns the absolute value of the given value.
58
+ *
59
+ * @category Math
60
+ * @returns `Math.abs(value)`
61
+ */
62
+ function abs(value) {
63
+ return Math.abs(value);
64
+ }
65
+ /**
66
+ * Returns the greatest integer less than or equal to the given value.
67
+ *
68
+ * @category Math
69
+ * @returns `Math.floor(value)`
70
+ */
71
+ function floor(value) {
72
+ return Math.floor(value);
73
+ }
74
+ /**
75
+ * Returns the smallest integer greater than or equal the given value.
76
+ *
77
+ * @category Math
78
+ * @returns `Math.ceil(value)`
79
+ */
80
+ function ceil(value) {
81
+ return Math.ceil(value);
82
+ }
83
+ /**
84
+ * Returns the given value rounded to the nearest integer.
85
+ *
86
+ * @category Math
87
+ * @returns `Math.round(value)`
88
+ */
89
+ function round(value) {
90
+ return Math.round(value);
91
+ }
92
+ /**
93
+ * Returns the larger value in the given collection.
94
+ *
95
+ * @category Math
96
+ * @returns `Math.max(values)`
97
+ */
98
+ function max(values) {
99
+ return Math.max(...values);
100
+ }
101
+ /**
102
+ * Returns the smallest value in the given collection.
103
+ *
104
+ * @category Math
105
+ * @returns `Math.min(values)`
106
+ */
107
+ function min(values) {
108
+ return Math.min(...values);
109
+ }
110
+ /**
111
+ * Takes the sum of all the values in the given collection.
112
+ *
113
+ * @category Math
114
+ * @returns `Math.sum(values)`
115
+ */
116
+ function sum(values) {
117
+ return [...values].reduce(add, 0);
118
+ }
119
+ function eq(...args) {
120
+ return args.length === 1 ? (a) => a === args[0] : args[0] === args[1];
121
+ }
122
+ function gt(...args) {
123
+ return args.length === 1 ? (a) => a > args[0] : args[0] > args[1];
124
+ }
125
+ function gte(...args) {
126
+ return args.length === 1 ? (a) => a >= args[0] : args[0] >= args[1];
127
+ }
128
+ function lt(...args) {
129
+ return args.length === 1 ? (a) => a < args[0] : args[0] < args[1];
130
+ }
131
+ function lte(...args) {
132
+ return args.length === 1 ? (a) => a <= args[0] : args[0] <= args[1];
133
+ }
134
+ /**
135
+ * Returns the sine of a number.
136
+ *
137
+ * @category Math
138
+ * @returns `Math.sin(angle)`
139
+ */
140
+ function sin(angle) {
141
+ return Math.sin(angle);
142
+ }
143
+ /**
144
+ * Returns the cosine of a number.
145
+ *
146
+ * @category Math
147
+ * @returns `Math.cos(angle)`
148
+ */
149
+ function cos(angle) {
150
+ return Math.cos(angle);
151
+ }
152
+ /**
153
+ * Returns the tangent of a number.
154
+ *
155
+ * @category Math
156
+ * @returns `Math.tan(angle)`
157
+ */
158
+ function tan(angle) {
159
+ return Math.tan(angle);
160
+ }
161
+ /**
162
+ * Returns the arcsine of a number.
163
+ *
164
+ * @category Math
165
+ * @returns `Math.asin(value)`
166
+ */
167
+ function asin(value) {
168
+ return Math.asin(value);
169
+ }
170
+ /**
171
+ * Returns the arc cosine (or inverse cosine) of a number.
172
+ *
173
+ * @category Math
174
+ * @returns `Math.acos(value)`
175
+ */
176
+ function acos(value) {
177
+ return Math.acos(value);
178
+ }
179
+ /**
180
+ * Returns the arctangent of a number.
181
+ *
182
+ * @category Math
183
+ * @returns `Math.atan(value)`
184
+ */
185
+ function atan(value) {
186
+ return Math.atan(value);
187
+ }
188
+ /**
189
+ * Returns the angle (in radians) from the X axis to a point.
190
+ *
191
+ * @category Math
192
+ * @param x - A number representing the cartesian x-coordinate.
193
+ * @param y - A number representing the cartesian y-coordinate.
194
+ * @returns `Math.atan2(x, y)`
195
+ */
196
+ function atan2(x, y) {
197
+ return Math.atan2(x, y);
198
+ }
199
+ /**
200
+ * Returns the hyperbolic sine of a number.
201
+ *
202
+ * @category Math
203
+ * @returns `Math.sinh(angle)`
204
+ */
205
+ function sinh(angle) {
206
+ return Math.sinh(angle);
207
+ }
208
+ /**
209
+ * Returns the hyperbolic cosine of a number.
210
+ *
211
+ * @category Math
212
+ * @returns `Math.cosh(angle)`
213
+ */
214
+ function cosh(angle) {
215
+ return Math.cosh(angle);
216
+ }
217
+ /**
218
+ * Returns the hyperbolic tangent of a number.
219
+ *
220
+ * @category Math
221
+ * @returns `Math.tanh(angle)`
222
+ */
223
+ function tanh(angle) {
224
+ return Math.tanh(angle);
225
+ }
226
+ /**
227
+ * Returns the inverse hyperbolic sine of a number.
228
+ *
229
+ * @category Math
230
+ * @returns `Math.asinh(value)`
231
+ */
232
+ function asinh(value) {
233
+ return Math.asinh(value);
234
+ }
235
+ /**
236
+ * Returns the inverse hyperbolic cosine of a number.
237
+ *
238
+ * @category Math
239
+ * @returns `Math.acosh(value)`
240
+ */
241
+ function acosh(value) {
242
+ return Math.acosh(value);
243
+ }
244
+ /**
245
+ * Returns the inverse hyperbolic tangent of a number.
246
+ *
247
+ * @category Math
248
+ * @returns `Math.atanh(value)`
249
+ */
250
+ function atanh(value) {
251
+ return Math.atanh(value);
252
+ }
253
+
254
+ exports.abs = abs;
255
+ exports.acos = acos;
256
+ exports.acosh = acosh;
257
+ exports.add = add;
258
+ exports.asin = asin;
259
+ exports.asinh = asinh;
260
+ exports.atan = atan;
261
+ exports.atan2 = atan2;
262
+ exports.atanh = atanh;
263
+ exports.ceil = ceil;
264
+ exports.cos = cos;
265
+ exports.cosh = cosh;
266
+ exports.div = div;
267
+ exports.eq = eq;
268
+ exports.floor = floor;
269
+ exports.gt = gt;
270
+ exports.gte = gte;
271
+ exports.inverse = inverse;
272
+ exports.lt = lt;
273
+ exports.lte = lte;
274
+ exports.max = max;
275
+ exports.min = min;
276
+ exports.mod = mod;
277
+ exports.modSafe = modSafe;
278
+ exports.mul = mul;
279
+ exports.negate = negate;
280
+ exports.pow = pow;
281
+ exports.root = root;
282
+ exports.round = round;
283
+ exports.sin = sin;
284
+ exports.sinh = sinh;
285
+ exports.sqrt = sqrt;
286
+ exports.sub = sub;
287
+ exports.sum = sum;
288
+ exports.tan = tan;
289
+ exports.tanh = tanh;