uom-types 3.0.0 → 3.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/README.md +2 -2
- package/dist/_angle-plane.d.cts +1 -1
- package/dist/_angle-plane.d.mts +1 -1
- package/dist/_identity.d.cts +1 -1
- package/dist/_identity.d.mts +1 -1
- package/dist/_time-duration.d.cts +7 -6
- package/dist/_time-duration.d.mts +7 -6
- package/dist/{_index.d.cts → _units.d.cts} +49 -26
- package/dist/{_index.d.mts → _units.d.mts} +49 -26
- package/dist/functions-higher-order.cjs +9 -0
- package/dist/functions-higher-order.d.cts +10 -3
- package/dist/functions-higher-order.d.mts +10 -3
- package/dist/functions-higher-order.mjs +9 -1
- package/dist/functions.cjs +10 -1
- package/dist/functions.d.cts +8 -38
- package/dist/functions.d.mts +8 -38
- package/dist/functions.mjs +10 -2
- package/dist/index.d.cts +17 -1
- package/dist/index.d.mts +17 -1
- package/dist/units-converters.d.cts +2 -2
- package/dist/units-converters.d.mts +2 -2
- package/dist/units.d.cts +3 -3
- package/dist/units.d.mts +3 -3
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ pnpm add -D uom-types
|
|
|
40
40
|
yarn add -D uom-types
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
### Library
|
|
43
|
+
### Library Structure
|
|
44
44
|
|
|
45
45
|
This library is split into several submodules.
|
|
46
46
|
|
|
@@ -54,7 +54,7 @@ This library is split into several submodules.
|
|
|
54
54
|
Defines runtime higher order mathematical functions that are type-aware of this library's type.
|
|
55
55
|
|
|
56
56
|
- `uom-types/units`\
|
|
57
|
-
Defines common
|
|
57
|
+
Defines common units.\
|
|
58
58
|
Note: does not currently define any imperial types.
|
|
59
59
|
|
|
60
60
|
- `uom-types/units/converters`\
|
package/dist/_angle-plane.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { w as Exactify, b as UnitClass, E as Exponent, a as AbstractUnitFrom, g as UnitSubvalues, f as UnitMeta, k as UnknownUnitMeta, e as UnitFrom } from './_units.cjs';
|
|
2
2
|
|
|
3
3
|
type SiUnitKeys = "Second" | "Metre" | "Kilogram" | "Mole" | "Ampere" | "Candela" | "Kelvin" | "Radian";
|
|
4
4
|
/**
|
package/dist/_angle-plane.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { w as Exactify, b as UnitClass, E as Exponent, a as AbstractUnitFrom, g as UnitSubvalues, f as UnitMeta, k as UnknownUnitMeta, e as UnitFrom } from './_units.mjs';
|
|
2
2
|
|
|
3
3
|
type SiUnitKeys = "Second" | "Metre" | "Kilogram" | "Mole" | "Ampere" | "Candela" | "Kelvin" | "Radian";
|
|
4
4
|
/**
|
package/dist/_identity.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as AbstractUnitFrom, g as UnitSubvalues, f as UnitMeta, k as UnknownUnitMeta, e as UnitFrom } from './_units.cjs';
|
|
2
2
|
import { B as BaseUnitClass } from './_angle-plane.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/_identity.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as AbstractUnitFrom, g as UnitSubvalues, f as UnitMeta, k as UnknownUnitMeta, e as UnitFrom } from './_units.mjs';
|
|
2
2
|
import { B as BaseUnitClass } from './_angle-plane.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as UnknownAbstractUnit, i as UnknownUnit, P as Pow, I as Inverse, j as UnknownUnitClass, b as UnitClass, r as InverseUnitSubvalues, g as UnitSubvalues, f as UnitMeta, k as UnknownUnitMeta, e as UnitFrom, a as AbstractUnitFrom } from './_units.cjs';
|
|
2
2
|
import { B as BaseUnitClass } from './_angle-plane.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -6,19 +6,19 @@ import { B as BaseUnitClass } from './_angle-plane.cjs';
|
|
|
6
6
|
*
|
|
7
7
|
* @group Modifiers
|
|
8
8
|
* @category General
|
|
9
|
-
* @see {@link
|
|
9
|
+
* @see {@link Pow}
|
|
10
10
|
* @see {@link Cubic}
|
|
11
11
|
*/
|
|
12
|
-
type Square<T extends UnknownAbstractUnit | UnknownUnit> =
|
|
12
|
+
type Square<T extends UnknownAbstractUnit | UnknownUnit> = Pow<T, 2>;
|
|
13
13
|
/**
|
|
14
14
|
* Put the given {@link Unit} to the power of 3.
|
|
15
15
|
*
|
|
16
16
|
* @group Modifiers
|
|
17
17
|
* @category General
|
|
18
|
-
* @see {@link
|
|
18
|
+
* @see {@link Pow}
|
|
19
19
|
* @see {@link Square}
|
|
20
20
|
*/
|
|
21
|
-
type Cubic<T extends UnknownAbstractUnit | UnknownUnit> =
|
|
21
|
+
type Cubic<T extends UnknownAbstractUnit | UnknownUnit> = Pow<T, 3>;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Invert the {@link Unit}.
|
|
@@ -296,6 +296,7 @@ type MassUnitFrom<M extends UnknownUnitMeta> = UnitFrom<MassUnitClass, M>;
|
|
|
296
296
|
* A unit of {@link Mass}.
|
|
297
297
|
*
|
|
298
298
|
* @group Units
|
|
299
|
+
* @category Base
|
|
299
300
|
* @category Mechanical
|
|
300
301
|
* @symbol `g`
|
|
301
302
|
*/
|
|
@@ -478,4 +479,4 @@ type Year = DurationUnit<{
|
|
|
478
479
|
scalarDayInYear: 1;
|
|
479
480
|
}>;
|
|
480
481
|
|
|
481
|
-
export {
|
|
482
|
+
export { Second as $, AreaUnitClass as A, MassUnitFrom as B, Tonne as C, Volume as D, EnergyUnitClass as E, FrequencyUnitClass as F, Gram as G, Hertz as H, VolumeUnit as I, Joule as J, VolumeUnitFrom as K, LengthUnitClass as L, Metre as M, Litre as N, TemperatureUnit as O, PerSecond as P, TemperatureUnitFrom as Q, ReciprocalUnitClass as R, Kelvin as S, TemperatureUnitClass as T, Celsius as U, VolumeUnitClass as V, WattSecond as W, DurationUnitClass as X, Duration as Y, DurationUnit as Z, DurationUnitFrom as _, Reciprocal as a, Minute as a0, Hour as a1, Day as a2, Week as a3, Year as a4, Square as a5, Cubic as a6, Energy as b, EnergyUnit as c, EnergyUnitFrom as d, Temperature as e, Frequency as f, FrequencyUnit as g, FrequencyUnitFrom as h, PerMinute as i, PerHour as j, PerDay as k, PerWeek as l, PerYear as m, Area as n, AreaUnit as o, AreaUnitFrom as p, Are as q, Hectare as r, WattMinute as s, WattHour as t, Length as u, LengthUnit as v, LengthUnitFrom as w, MassUnitClass as x, Mass as y, MassUnit as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as UnknownAbstractUnit, i as UnknownUnit, P as Pow, I as Inverse, j as UnknownUnitClass, b as UnitClass, r as InverseUnitSubvalues, g as UnitSubvalues, f as UnitMeta, k as UnknownUnitMeta, e as UnitFrom, a as AbstractUnitFrom } from './_units.mjs';
|
|
2
2
|
import { B as BaseUnitClass } from './_angle-plane.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -6,19 +6,19 @@ import { B as BaseUnitClass } from './_angle-plane.mjs';
|
|
|
6
6
|
*
|
|
7
7
|
* @group Modifiers
|
|
8
8
|
* @category General
|
|
9
|
-
* @see {@link
|
|
9
|
+
* @see {@link Pow}
|
|
10
10
|
* @see {@link Cubic}
|
|
11
11
|
*/
|
|
12
|
-
type Square<T extends UnknownAbstractUnit | UnknownUnit> =
|
|
12
|
+
type Square<T extends UnknownAbstractUnit | UnknownUnit> = Pow<T, 2>;
|
|
13
13
|
/**
|
|
14
14
|
* Put the given {@link Unit} to the power of 3.
|
|
15
15
|
*
|
|
16
16
|
* @group Modifiers
|
|
17
17
|
* @category General
|
|
18
|
-
* @see {@link
|
|
18
|
+
* @see {@link Pow}
|
|
19
19
|
* @see {@link Square}
|
|
20
20
|
*/
|
|
21
|
-
type Cubic<T extends UnknownAbstractUnit | UnknownUnit> =
|
|
21
|
+
type Cubic<T extends UnknownAbstractUnit | UnknownUnit> = Pow<T, 3>;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Invert the {@link Unit}.
|
|
@@ -296,6 +296,7 @@ type MassUnitFrom<M extends UnknownUnitMeta> = UnitFrom<MassUnitClass, M>;
|
|
|
296
296
|
* A unit of {@link Mass}.
|
|
297
297
|
*
|
|
298
298
|
* @group Units
|
|
299
|
+
* @category Base
|
|
299
300
|
* @category Mechanical
|
|
300
301
|
* @symbol `g`
|
|
301
302
|
*/
|
|
@@ -478,4 +479,4 @@ type Year = DurationUnit<{
|
|
|
478
479
|
scalarDayInYear: 1;
|
|
479
480
|
}>;
|
|
480
481
|
|
|
481
|
-
export {
|
|
482
|
+
export { Second as $, AreaUnitClass as A, MassUnitFrom as B, Tonne as C, Volume as D, EnergyUnitClass as E, FrequencyUnitClass as F, Gram as G, Hertz as H, VolumeUnit as I, Joule as J, VolumeUnitFrom as K, LengthUnitClass as L, Metre as M, Litre as N, TemperatureUnit as O, PerSecond as P, TemperatureUnitFrom as Q, ReciprocalUnitClass as R, Kelvin as S, TemperatureUnitClass as T, Celsius as U, VolumeUnitClass as V, WattSecond as W, DurationUnitClass as X, Duration as Y, DurationUnit as Z, DurationUnitFrom as _, Reciprocal as a, Minute as a0, Hour as a1, Day as a2, Week as a3, Year as a4, Square as a5, Cubic as a6, Energy as b, EnergyUnit as c, EnergyUnitFrom as d, Temperature as e, Frequency as f, FrequencyUnit as g, FrequencyUnitFrom as h, PerMinute as i, PerHour as j, PerDay as k, PerWeek as l, PerYear as m, Area as n, AreaUnit as o, AreaUnitFrom as p, Are as q, Hectare as r, WattMinute as s, WattHour as t, Length as u, LengthUnit as v, LengthUnitFrom as w, MassUnitClass as x, Mass as y, MassUnit as z };
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Autogenerated File - Don't manually edit.
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* All the supported positive exponent values.
|
|
6
|
+
*
|
|
7
|
+
* @group Unit Components
|
|
8
|
+
*/
|
|
9
|
+
type PosExponent = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
10
|
+
/**
|
|
11
|
+
* All the supported negative exponent values.
|
|
12
|
+
*
|
|
13
|
+
* @group Unit Components
|
|
14
|
+
*/
|
|
15
|
+
type NegExponent = -1 | -2 | -3 | -4 | -5 | -6 | -7 | -8 | -9 | -10 | -11 | -12;
|
|
4
16
|
/**
|
|
5
17
|
* All the supported exponent values.
|
|
6
18
|
*
|
|
7
19
|
* @group Unit Components
|
|
8
20
|
*/
|
|
9
|
-
type Exponent = 0 |
|
|
21
|
+
type Exponent = 0 | PosExponent | NegExponent;
|
|
10
22
|
/**
|
|
11
23
|
* @group Exponent Functions
|
|
12
24
|
*/
|
|
13
|
-
type
|
|
25
|
+
type NegateExponent<T extends Exponent> = MultiplyExponents<T, -1>;
|
|
26
|
+
/**
|
|
27
|
+
* @depreated Use {@link NegateExponent} instead.
|
|
28
|
+
*/
|
|
29
|
+
type NegativeExponent<T extends Exponent> = NegateExponent<T>;
|
|
14
30
|
/**
|
|
15
31
|
* @group Exponent Functions
|
|
16
32
|
*/
|
|
@@ -169,40 +185,19 @@ type UnknownUnitKeyValues = {
|
|
|
169
185
|
*/
|
|
170
186
|
type UnitSubvalues = Record<string, Exponent>;
|
|
171
187
|
|
|
172
|
-
/**
|
|
173
|
-
* Multiple the exponent values of a unit by a number.
|
|
174
|
-
*
|
|
175
|
-
* @group Unit Functions
|
|
176
|
-
*/
|
|
177
|
-
type MultiplyUnitExponents<T extends number, E extends Exponent> = T extends Unit<infer Config, infer Meta> ? Unit<FlatternAlias<MultiplyUnitSubvaluesExponents<Config, E>>, FlatternAlias<MultiplyUnitSubvaluesExponents<Meta, E>>> : number;
|
|
178
|
-
type MultiplyUnitSubvaluesExponents<T extends UnitSubvalues, E extends Exponent> = {
|
|
179
|
-
[S in keyof T]: MultiplyExponents<GetExponent<T, S>, E>;
|
|
180
|
-
};
|
|
181
|
-
/**
|
|
182
|
-
* Divide the exponent values of a unit by a number.
|
|
183
|
-
*
|
|
184
|
-
* @group Unit Functions
|
|
185
|
-
*/
|
|
186
|
-
type DivideUnitExponents<T extends number, E extends Exponent> = T extends Unit<infer Config, infer Meta> ? Unit<FlatternAlias<DivideUnitSubvaluesExponents<Config, E>>, FlatternAlias<DivideUnitSubvaluesExponents<Meta, E>>> : number;
|
|
187
|
-
type DivideUnitSubvaluesExponents<T extends UnitSubvalues, E extends Exponent> = {
|
|
188
|
-
[S in keyof T]: DivideExponents<GetExponent<T, S>, E>;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
188
|
/**
|
|
192
189
|
* Take the inverse of a unit.
|
|
193
190
|
*
|
|
194
191
|
* @group Unit Functions
|
|
195
192
|
* @returns `1/X`.
|
|
196
193
|
*/
|
|
197
|
-
type Inverse<X extends number> = X
|
|
194
|
+
type Inverse<X extends number> = Pow<X, -1>;
|
|
198
195
|
/**
|
|
199
196
|
* Inverses each of the subvalues.
|
|
200
197
|
*
|
|
201
198
|
* @group Unit Subvalue Functions
|
|
202
199
|
*/
|
|
203
|
-
type InverseUnitSubvalues<T extends UnitSubvalues> =
|
|
204
|
-
[E in keyof T]: NegativeExponent<T[E]>;
|
|
205
|
-
};
|
|
200
|
+
type InverseUnitSubvalues<T extends UnitSubvalues> = PowUnitSubvalues<T, -1>;
|
|
206
201
|
/**
|
|
207
202
|
* Multiply a unit by another unit.
|
|
208
203
|
*
|
|
@@ -231,5 +226,33 @@ type Divide<A extends number, B extends number> = Multiply<A, Inverse<B>>;
|
|
|
231
226
|
* @group Unit Subvalue Functions
|
|
232
227
|
*/
|
|
233
228
|
type DivideUnitSubvalues<A extends UnitSubvalues, B extends UnitSubvalues> = MultiplyUnitSubvalues<A, InverseUnitSubvalues<B>>;
|
|
229
|
+
/**
|
|
230
|
+
* Put a unit to the power of an exponent.
|
|
231
|
+
*
|
|
232
|
+
* @group Unit Functions
|
|
233
|
+
*/
|
|
234
|
+
type Pow<T extends number, N extends Exponent> = T extends Unit<infer Config, infer Meta> ? Unit<FlatternAlias<PowUnitSubvalues<Config, N>>, FlatternAlias<PowUnitSubvalues<Meta, N>>> : T extends AbstractUnit<infer Config> ? AbstractUnit<FlatternAlias<PowUnitSubvalues<Config, N>>> : number;
|
|
235
|
+
/**
|
|
236
|
+
* Put each subvalue of a unit to the power of an exponent.
|
|
237
|
+
*
|
|
238
|
+
* @group Unit Subvalue Functions
|
|
239
|
+
*/
|
|
240
|
+
type PowUnitSubvalues<T extends UnitSubvalues, E extends Exponent> = ExcludeUnitZeroSubvalues<{
|
|
241
|
+
[S in keyof T]: MultiplyExponents<GetExponent<T, S>, E>;
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* Take the nth root of a unit.
|
|
245
|
+
*
|
|
246
|
+
* @group Unit Functions
|
|
247
|
+
*/
|
|
248
|
+
type Root<T extends number, N extends Exponent> = T extends Unit<infer Config, infer Meta> ? Unit<FlatternAlias<RootUnitSubvalues<Config, N>>, FlatternAlias<RootUnitSubvalues<Meta, N>>> : T extends AbstractUnit<infer Config> ? AbstractUnit<FlatternAlias<RootUnitSubvalues<Config, N>>> : number;
|
|
249
|
+
/**
|
|
250
|
+
* Take the nth root of each subvalue of a unit.
|
|
251
|
+
*
|
|
252
|
+
* @group Unit Subvalue Functions
|
|
253
|
+
*/
|
|
254
|
+
type RootUnitSubvalues<T extends UnitSubvalues, E extends Exponent> = ExcludeUnitZeroSubvalues<{
|
|
255
|
+
[S in keyof T]: DivideExponents<GetExponent<T, S>, E>;
|
|
256
|
+
}>;
|
|
234
257
|
|
|
235
|
-
export { AbstractUnit as A,
|
|
258
|
+
export { AbstractUnit as A, DivideExponents as D, Exponent as E, Inverse as I, MultiplyExponents as M, NegateExponent as N, Pow as P, Root as R, SubExponents as S, Unit as U, AbstractUnitFrom as a, UnitClass as b, UnitConversionRate as c, UnitConversionRateFrom as d, UnitFrom as e, UnitMeta as f, UnitSubvalues as g, UnknownAbstractUnit as h, UnknownUnit as i, UnknownUnitClass as j, UnknownUnitMeta as k, NegativeExponent as l, NegExponent as m, PosExponent as n, SumExponents as o, Divide as p, DivideUnitSubvalues as q, InverseUnitSubvalues as r, Multiply as s, MultiplyUnitSubvalues as t, PowUnitSubvalues as u, RootUnitSubvalues as v, Exactify as w };
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Autogenerated File - Don't manually edit.
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* All the supported positive exponent values.
|
|
6
|
+
*
|
|
7
|
+
* @group Unit Components
|
|
8
|
+
*/
|
|
9
|
+
type PosExponent = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
10
|
+
/**
|
|
11
|
+
* All the supported negative exponent values.
|
|
12
|
+
*
|
|
13
|
+
* @group Unit Components
|
|
14
|
+
*/
|
|
15
|
+
type NegExponent = -1 | -2 | -3 | -4 | -5 | -6 | -7 | -8 | -9 | -10 | -11 | -12;
|
|
4
16
|
/**
|
|
5
17
|
* All the supported exponent values.
|
|
6
18
|
*
|
|
7
19
|
* @group Unit Components
|
|
8
20
|
*/
|
|
9
|
-
type Exponent = 0 |
|
|
21
|
+
type Exponent = 0 | PosExponent | NegExponent;
|
|
10
22
|
/**
|
|
11
23
|
* @group Exponent Functions
|
|
12
24
|
*/
|
|
13
|
-
type
|
|
25
|
+
type NegateExponent<T extends Exponent> = MultiplyExponents<T, -1>;
|
|
26
|
+
/**
|
|
27
|
+
* @depreated Use {@link NegateExponent} instead.
|
|
28
|
+
*/
|
|
29
|
+
type NegativeExponent<T extends Exponent> = NegateExponent<T>;
|
|
14
30
|
/**
|
|
15
31
|
* @group Exponent Functions
|
|
16
32
|
*/
|
|
@@ -169,40 +185,19 @@ type UnknownUnitKeyValues = {
|
|
|
169
185
|
*/
|
|
170
186
|
type UnitSubvalues = Record<string, Exponent>;
|
|
171
187
|
|
|
172
|
-
/**
|
|
173
|
-
* Multiple the exponent values of a unit by a number.
|
|
174
|
-
*
|
|
175
|
-
* @group Unit Functions
|
|
176
|
-
*/
|
|
177
|
-
type MultiplyUnitExponents<T extends number, E extends Exponent> = T extends Unit<infer Config, infer Meta> ? Unit<FlatternAlias<MultiplyUnitSubvaluesExponents<Config, E>>, FlatternAlias<MultiplyUnitSubvaluesExponents<Meta, E>>> : number;
|
|
178
|
-
type MultiplyUnitSubvaluesExponents<T extends UnitSubvalues, E extends Exponent> = {
|
|
179
|
-
[S in keyof T]: MultiplyExponents<GetExponent<T, S>, E>;
|
|
180
|
-
};
|
|
181
|
-
/**
|
|
182
|
-
* Divide the exponent values of a unit by a number.
|
|
183
|
-
*
|
|
184
|
-
* @group Unit Functions
|
|
185
|
-
*/
|
|
186
|
-
type DivideUnitExponents<T extends number, E extends Exponent> = T extends Unit<infer Config, infer Meta> ? Unit<FlatternAlias<DivideUnitSubvaluesExponents<Config, E>>, FlatternAlias<DivideUnitSubvaluesExponents<Meta, E>>> : number;
|
|
187
|
-
type DivideUnitSubvaluesExponents<T extends UnitSubvalues, E extends Exponent> = {
|
|
188
|
-
[S in keyof T]: DivideExponents<GetExponent<T, S>, E>;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
188
|
/**
|
|
192
189
|
* Take the inverse of a unit.
|
|
193
190
|
*
|
|
194
191
|
* @group Unit Functions
|
|
195
192
|
* @returns `1/X`.
|
|
196
193
|
*/
|
|
197
|
-
type Inverse<X extends number> = X
|
|
194
|
+
type Inverse<X extends number> = Pow<X, -1>;
|
|
198
195
|
/**
|
|
199
196
|
* Inverses each of the subvalues.
|
|
200
197
|
*
|
|
201
198
|
* @group Unit Subvalue Functions
|
|
202
199
|
*/
|
|
203
|
-
type InverseUnitSubvalues<T extends UnitSubvalues> =
|
|
204
|
-
[E in keyof T]: NegativeExponent<T[E]>;
|
|
205
|
-
};
|
|
200
|
+
type InverseUnitSubvalues<T extends UnitSubvalues> = PowUnitSubvalues<T, -1>;
|
|
206
201
|
/**
|
|
207
202
|
* Multiply a unit by another unit.
|
|
208
203
|
*
|
|
@@ -231,5 +226,33 @@ type Divide<A extends number, B extends number> = Multiply<A, Inverse<B>>;
|
|
|
231
226
|
* @group Unit Subvalue Functions
|
|
232
227
|
*/
|
|
233
228
|
type DivideUnitSubvalues<A extends UnitSubvalues, B extends UnitSubvalues> = MultiplyUnitSubvalues<A, InverseUnitSubvalues<B>>;
|
|
229
|
+
/**
|
|
230
|
+
* Put a unit to the power of an exponent.
|
|
231
|
+
*
|
|
232
|
+
* @group Unit Functions
|
|
233
|
+
*/
|
|
234
|
+
type Pow<T extends number, N extends Exponent> = T extends Unit<infer Config, infer Meta> ? Unit<FlatternAlias<PowUnitSubvalues<Config, N>>, FlatternAlias<PowUnitSubvalues<Meta, N>>> : T extends AbstractUnit<infer Config> ? AbstractUnit<FlatternAlias<PowUnitSubvalues<Config, N>>> : number;
|
|
235
|
+
/**
|
|
236
|
+
* Put each subvalue of a unit to the power of an exponent.
|
|
237
|
+
*
|
|
238
|
+
* @group Unit Subvalue Functions
|
|
239
|
+
*/
|
|
240
|
+
type PowUnitSubvalues<T extends UnitSubvalues, E extends Exponent> = ExcludeUnitZeroSubvalues<{
|
|
241
|
+
[S in keyof T]: MultiplyExponents<GetExponent<T, S>, E>;
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* Take the nth root of a unit.
|
|
245
|
+
*
|
|
246
|
+
* @group Unit Functions
|
|
247
|
+
*/
|
|
248
|
+
type Root<T extends number, N extends Exponent> = T extends Unit<infer Config, infer Meta> ? Unit<FlatternAlias<RootUnitSubvalues<Config, N>>, FlatternAlias<RootUnitSubvalues<Meta, N>>> : T extends AbstractUnit<infer Config> ? AbstractUnit<FlatternAlias<RootUnitSubvalues<Config, N>>> : number;
|
|
249
|
+
/**
|
|
250
|
+
* Take the nth root of each subvalue of a unit.
|
|
251
|
+
*
|
|
252
|
+
* @group Unit Subvalue Functions
|
|
253
|
+
*/
|
|
254
|
+
type RootUnitSubvalues<T extends UnitSubvalues, E extends Exponent> = ExcludeUnitZeroSubvalues<{
|
|
255
|
+
[S in keyof T]: DivideExponents<GetExponent<T, S>, E>;
|
|
256
|
+
}>;
|
|
234
257
|
|
|
235
|
-
export { AbstractUnit as A,
|
|
258
|
+
export { AbstractUnit as A, DivideExponents as D, Exponent as E, Inverse as I, MultiplyExponents as M, NegateExponent as N, Pow as P, Root as R, SubExponents as S, Unit as U, AbstractUnitFrom as a, UnitClass as b, UnitConversionRate as c, UnitConversionRateFrom as d, UnitFrom as e, UnitMeta as f, UnitSubvalues as g, UnknownAbstractUnit as h, UnknownUnit as i, UnknownUnitClass as j, UnknownUnitMeta as k, NegativeExponent as l, NegExponent as m, PosExponent as n, SumExponents as o, Divide as p, DivideUnitSubvalues as q, InverseUnitSubvalues as r, Multiply as s, MultiplyUnitSubvalues as t, PowUnitSubvalues as u, RootUnitSubvalues as v, Exactify as w };
|
|
@@ -61,6 +61,14 @@ function modSafe(a) {
|
|
|
61
61
|
function pow(exponent) {
|
|
62
62
|
return (base) => (base ** exponent);
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Take the nth root of a number.
|
|
66
|
+
*
|
|
67
|
+
* @category Math
|
|
68
|
+
*/
|
|
69
|
+
function root(exponent) {
|
|
70
|
+
return (base) => (base ** (1 / exponent));
|
|
71
|
+
}
|
|
64
72
|
/**
|
|
65
73
|
* Equal: Compare if a value is equal to the given value.
|
|
66
74
|
*
|
|
@@ -113,4 +121,5 @@ exports.mod = mod;
|
|
|
113
121
|
exports.modSafe = modSafe;
|
|
114
122
|
exports.mul = mul;
|
|
115
123
|
exports.pow = pow;
|
|
124
|
+
exports.root = root;
|
|
116
125
|
exports.sub = sub;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as Multiply, p as Divide, i as UnknownUnit, h as UnknownAbstractUnit, E as Exponent, P as Pow, R as Root, n as PosExponent } from './_units.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @module uom-types/functions/higher-order
|
|
@@ -43,13 +43,20 @@ declare function mod<T extends number>(a: OperationIO<T>): (b: OperationIO<T>) =
|
|
|
43
43
|
* @category Math
|
|
44
44
|
*/
|
|
45
45
|
declare function modSafe<T extends number>(a: OperationIO<T>): (b: OperationIO<T>) => OperationIO<T>;
|
|
46
|
-
type PowFunction<E extends number, B extends number> = E extends UnknownUnit ? never : E extends UnknownAbstractUnit ? never : E extends
|
|
46
|
+
type PowFunction<E extends number, B extends number> = E extends UnknownUnit ? never : E extends UnknownAbstractUnit ? never : E extends Exponent ? (b: B) => Pow<B, E> : E extends 0.5 ? (b: B) => Root<B, 2> : (b: B) => number;
|
|
47
47
|
/**
|
|
48
48
|
* Put a number to the power of the given value.
|
|
49
49
|
*
|
|
50
50
|
* @category Math
|
|
51
51
|
*/
|
|
52
52
|
declare function pow<E extends number>(exponent: E): <B extends number>(base: Parameters<PowFunction<E, B>>[0]) => ReturnType<PowFunction<E, B>>;
|
|
53
|
+
type RootFunction<E extends number, B extends number> = E extends UnknownUnit ? never : E extends UnknownAbstractUnit ? never : E extends PosExponent ? (b: B) => Root<B, E> : (b: B) => number;
|
|
54
|
+
/**
|
|
55
|
+
* Take the nth root of a number.
|
|
56
|
+
*
|
|
57
|
+
* @category Math
|
|
58
|
+
*/
|
|
59
|
+
declare function root<N extends number>(exponent: N): <B extends number>(base: Parameters<RootFunction<N, B>>[0]) => ReturnType<RootFunction<N, B>>;
|
|
53
60
|
/**
|
|
54
61
|
* Equal: Compare if a value is equal to the given value.
|
|
55
62
|
*
|
|
@@ -81,4 +88,4 @@ declare function lt<T extends number>(a: OperationIO<T>): (b: OperationIO<T>) =>
|
|
|
81
88
|
*/
|
|
82
89
|
declare function lte<T extends number>(a: OperationIO<T>): (b: OperationIO<T>) => boolean;
|
|
83
90
|
|
|
84
|
-
export { add, div, eq, gt, gte, lt, lte, mod, modSafe, mul, pow, sub };
|
|
91
|
+
export { add, div, eq, gt, gte, lt, lte, mod, modSafe, mul, pow, root, sub };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as Multiply, p as Divide, i as UnknownUnit, h as UnknownAbstractUnit, E as Exponent, P as Pow, R as Root, n as PosExponent } from './_units.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @module uom-types/functions/higher-order
|
|
@@ -43,13 +43,20 @@ declare function mod<T extends number>(a: OperationIO<T>): (b: OperationIO<T>) =
|
|
|
43
43
|
* @category Math
|
|
44
44
|
*/
|
|
45
45
|
declare function modSafe<T extends number>(a: OperationIO<T>): (b: OperationIO<T>) => OperationIO<T>;
|
|
46
|
-
type PowFunction<E extends number, B extends number> = E extends UnknownUnit ? never : E extends UnknownAbstractUnit ? never : E extends
|
|
46
|
+
type PowFunction<E extends number, B extends number> = E extends UnknownUnit ? never : E extends UnknownAbstractUnit ? never : E extends Exponent ? (b: B) => Pow<B, E> : E extends 0.5 ? (b: B) => Root<B, 2> : (b: B) => number;
|
|
47
47
|
/**
|
|
48
48
|
* Put a number to the power of the given value.
|
|
49
49
|
*
|
|
50
50
|
* @category Math
|
|
51
51
|
*/
|
|
52
52
|
declare function pow<E extends number>(exponent: E): <B extends number>(base: Parameters<PowFunction<E, B>>[0]) => ReturnType<PowFunction<E, B>>;
|
|
53
|
+
type RootFunction<E extends number, B extends number> = E extends UnknownUnit ? never : E extends UnknownAbstractUnit ? never : E extends PosExponent ? (b: B) => Root<B, E> : (b: B) => number;
|
|
54
|
+
/**
|
|
55
|
+
* Take the nth root of a number.
|
|
56
|
+
*
|
|
57
|
+
* @category Math
|
|
58
|
+
*/
|
|
59
|
+
declare function root<N extends number>(exponent: N): <B extends number>(base: Parameters<RootFunction<N, B>>[0]) => ReturnType<RootFunction<N, B>>;
|
|
53
60
|
/**
|
|
54
61
|
* Equal: Compare if a value is equal to the given value.
|
|
55
62
|
*
|
|
@@ -81,4 +88,4 @@ declare function lt<T extends number>(a: OperationIO<T>): (b: OperationIO<T>) =>
|
|
|
81
88
|
*/
|
|
82
89
|
declare function lte<T extends number>(a: OperationIO<T>): (b: OperationIO<T>) => boolean;
|
|
83
90
|
|
|
84
|
-
export { add, div, eq, gt, gte, lt, lte, mod, modSafe, mul, pow, sub };
|
|
91
|
+
export { add, div, eq, gt, gte, lt, lte, mod, modSafe, mul, pow, root, sub };
|
|
@@ -59,6 +59,14 @@ function modSafe(a) {
|
|
|
59
59
|
function pow(exponent) {
|
|
60
60
|
return (base) => (base ** exponent);
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Take the nth root of a number.
|
|
64
|
+
*
|
|
65
|
+
* @category Math
|
|
66
|
+
*/
|
|
67
|
+
function root(exponent) {
|
|
68
|
+
return (base) => (base ** (1 / exponent));
|
|
69
|
+
}
|
|
62
70
|
/**
|
|
63
71
|
* Equal: Compare if a value is equal to the given value.
|
|
64
72
|
*
|
|
@@ -100,4 +108,4 @@ function lte(a) {
|
|
|
100
108
|
return (b) => b <= a;
|
|
101
109
|
}
|
|
102
110
|
|
|
103
|
-
export { add, div, eq, gt, gte, lt, lte, mod, modSafe, mul, pow, sub };
|
|
111
|
+
export { add, div, eq, gt, gte, lt, lte, mod, modSafe, mul, pow, root, sub };
|
package/dist/functions.cjs
CHANGED
|
@@ -60,13 +60,21 @@ function modSafe(a, b) {
|
|
|
60
60
|
function pow(base, exponent) {
|
|
61
61
|
return base ** exponent;
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Take the nth root of a number.
|
|
65
|
+
*
|
|
66
|
+
* @category Math
|
|
67
|
+
*/
|
|
68
|
+
function root(base, exponent) {
|
|
69
|
+
return (base ** (1 / exponent));
|
|
70
|
+
}
|
|
63
71
|
/**
|
|
64
72
|
* Take the square root of the given value.
|
|
65
73
|
*
|
|
66
74
|
* @category Math
|
|
67
75
|
*/
|
|
68
76
|
function sqrt(value) {
|
|
69
|
-
return
|
|
77
|
+
return root(value, 2);
|
|
70
78
|
}
|
|
71
79
|
/**
|
|
72
80
|
* Inverse the given value.
|
|
@@ -314,6 +322,7 @@ exports.modSafe = modSafe;
|
|
|
314
322
|
exports.mul = mul;
|
|
315
323
|
exports.negate = negate;
|
|
316
324
|
exports.pow = pow;
|
|
325
|
+
exports.root = root;
|
|
317
326
|
exports.round = round;
|
|
318
327
|
exports.sin = sin;
|
|
319
328
|
exports.sinh = sinh;
|
package/dist/functions.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as Multiply, p as Divide, i as UnknownUnit, h as UnknownAbstractUnit, E as Exponent, P as Pow, R as Root, n as PosExponent, I as Inverse } from './_units.cjs';
|
|
2
2
|
import { R as Radian } from './_angle-plane.cjs';
|
|
3
3
|
import { U as Unitless } from './_identity.cjs';
|
|
4
4
|
|
|
@@ -52,59 +52,29 @@ declare function mod<T extends number>(a: OperationIO<T>, b: OperationIO<T>): Op
|
|
|
52
52
|
*/
|
|
53
53
|
declare function modSafe<T extends number>(a: OperationIO<T>, b: OperationIO<T>): OperationIO<T>;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Raise a number to the power of another.
|
|
56
56
|
*
|
|
57
57
|
* @category Math
|
|
58
58
|
*/
|
|
59
|
-
declare function pow<B extends number>(base: B, exponent:
|
|
60
|
-
/**
|
|
61
|
-
* Put a number to the power of 0.
|
|
62
|
-
*
|
|
63
|
-
* @category Math
|
|
64
|
-
*/
|
|
65
|
-
declare function pow<B extends number>(base: B, exponent: 0): B extends UnknownUnit ? Unit<{}> : B extends UnknownAbstractUnit ? AbstractUnit<{}> : 1;
|
|
59
|
+
declare function pow<B extends number, E extends number>(base: B, exponent: E extends UnknownUnit ? never : E extends UnknownAbstractUnit ? never : E): E extends Exponent ? Pow<B, E> : number;
|
|
66
60
|
/**
|
|
67
61
|
* Put a number to the power of 1/2.
|
|
68
62
|
*
|
|
69
63
|
* @category Math
|
|
70
64
|
*/
|
|
71
|
-
declare function pow<B extends number>(base: B, exponent: 0.5):
|
|
72
|
-
/**
|
|
73
|
-
* Put a number to the power of 1.
|
|
74
|
-
*
|
|
75
|
-
* @category Math
|
|
76
|
-
*/
|
|
77
|
-
declare function pow<E extends number>(base: E, exponent: 1): E;
|
|
78
|
-
/**
|
|
79
|
-
* Put a number to the power of 2.
|
|
80
|
-
*
|
|
81
|
-
* @category Math
|
|
82
|
-
*/
|
|
83
|
-
declare function pow<B extends number>(base: B, exponent: 2): Multiply<B, B>;
|
|
84
|
-
/**
|
|
85
|
-
* Put a number to the power of 3.
|
|
86
|
-
*
|
|
87
|
-
* @category Math
|
|
88
|
-
*/
|
|
89
|
-
declare function pow<B extends number>(base: B, exponent: 3): Multiply<B, Multiply<B, B>>;
|
|
90
|
-
/**
|
|
91
|
-
* Put a number to the power of 4.
|
|
92
|
-
*
|
|
93
|
-
* @category Math
|
|
94
|
-
*/
|
|
95
|
-
declare function pow<B extends number>(base: B, exponent: 4): Multiply<B, Multiply<B, Multiply<B, B>>>;
|
|
65
|
+
declare function pow<B extends number>(base: B, exponent: 0.5): Root<B, 2>;
|
|
96
66
|
/**
|
|
97
|
-
*
|
|
67
|
+
* Take the nth root of a number.
|
|
98
68
|
*
|
|
99
69
|
* @category Math
|
|
100
70
|
*/
|
|
101
|
-
declare function
|
|
71
|
+
declare function root<B extends number, N extends number>(base: B, exponent: N extends UnknownUnit ? never : N extends UnknownAbstractUnit ? never : N): N extends PosExponent ? Root<B, N> : number;
|
|
102
72
|
/**
|
|
103
73
|
* Take the square root of the given value.
|
|
104
74
|
*
|
|
105
75
|
* @category Math
|
|
106
76
|
*/
|
|
107
|
-
declare function sqrt<T extends number>(value: T):
|
|
77
|
+
declare function sqrt<T extends number>(value: T): Root<T, 2>;
|
|
108
78
|
/**
|
|
109
79
|
* Inverse the given value.
|
|
110
80
|
*
|
|
@@ -270,4 +240,4 @@ declare function acosh(value: Unitless): Radian;
|
|
|
270
240
|
*/
|
|
271
241
|
declare function atanh(value: Unitless): Radian;
|
|
272
242
|
|
|
273
|
-
export { abs, acos, acosh, add, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, div, eq, floor, gt, gte, inverse, lt, lte, max, min, mod, modSafe, mul, negate, pow, round, sin, sinh, sqrt, sub, sum, tan, tanh };
|
|
243
|
+
export { abs, acos, acosh, add, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, div, eq, floor, gt, gte, inverse, lt, lte, max, min, mod, modSafe, mul, negate, pow, root, round, sin, sinh, sqrt, sub, sum, tan, tanh };
|
package/dist/functions.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as Multiply, p as Divide, i as UnknownUnit, h as UnknownAbstractUnit, E as Exponent, P as Pow, R as Root, n as PosExponent, I as Inverse } from './_units.mjs';
|
|
2
2
|
import { R as Radian } from './_angle-plane.mjs';
|
|
3
3
|
import { U as Unitless } from './_identity.mjs';
|
|
4
4
|
|
|
@@ -52,59 +52,29 @@ declare function mod<T extends number>(a: OperationIO<T>, b: OperationIO<T>): Op
|
|
|
52
52
|
*/
|
|
53
53
|
declare function modSafe<T extends number>(a: OperationIO<T>, b: OperationIO<T>): OperationIO<T>;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Raise a number to the power of another.
|
|
56
56
|
*
|
|
57
57
|
* @category Math
|
|
58
58
|
*/
|
|
59
|
-
declare function pow<B extends number>(base: B, exponent:
|
|
60
|
-
/**
|
|
61
|
-
* Put a number to the power of 0.
|
|
62
|
-
*
|
|
63
|
-
* @category Math
|
|
64
|
-
*/
|
|
65
|
-
declare function pow<B extends number>(base: B, exponent: 0): B extends UnknownUnit ? Unit<{}> : B extends UnknownAbstractUnit ? AbstractUnit<{}> : 1;
|
|
59
|
+
declare function pow<B extends number, E extends number>(base: B, exponent: E extends UnknownUnit ? never : E extends UnknownAbstractUnit ? never : E): E extends Exponent ? Pow<B, E> : number;
|
|
66
60
|
/**
|
|
67
61
|
* Put a number to the power of 1/2.
|
|
68
62
|
*
|
|
69
63
|
* @category Math
|
|
70
64
|
*/
|
|
71
|
-
declare function pow<B extends number>(base: B, exponent: 0.5):
|
|
72
|
-
/**
|
|
73
|
-
* Put a number to the power of 1.
|
|
74
|
-
*
|
|
75
|
-
* @category Math
|
|
76
|
-
*/
|
|
77
|
-
declare function pow<E extends number>(base: E, exponent: 1): E;
|
|
78
|
-
/**
|
|
79
|
-
* Put a number to the power of 2.
|
|
80
|
-
*
|
|
81
|
-
* @category Math
|
|
82
|
-
*/
|
|
83
|
-
declare function pow<B extends number>(base: B, exponent: 2): Multiply<B, B>;
|
|
84
|
-
/**
|
|
85
|
-
* Put a number to the power of 3.
|
|
86
|
-
*
|
|
87
|
-
* @category Math
|
|
88
|
-
*/
|
|
89
|
-
declare function pow<B extends number>(base: B, exponent: 3): Multiply<B, Multiply<B, B>>;
|
|
90
|
-
/**
|
|
91
|
-
* Put a number to the power of 4.
|
|
92
|
-
*
|
|
93
|
-
* @category Math
|
|
94
|
-
*/
|
|
95
|
-
declare function pow<B extends number>(base: B, exponent: 4): Multiply<B, Multiply<B, Multiply<B, B>>>;
|
|
65
|
+
declare function pow<B extends number>(base: B, exponent: 0.5): Root<B, 2>;
|
|
96
66
|
/**
|
|
97
|
-
*
|
|
67
|
+
* Take the nth root of a number.
|
|
98
68
|
*
|
|
99
69
|
* @category Math
|
|
100
70
|
*/
|
|
101
|
-
declare function
|
|
71
|
+
declare function root<B extends number, N extends number>(base: B, exponent: N extends UnknownUnit ? never : N extends UnknownAbstractUnit ? never : N): N extends PosExponent ? Root<B, N> : number;
|
|
102
72
|
/**
|
|
103
73
|
* Take the square root of the given value.
|
|
104
74
|
*
|
|
105
75
|
* @category Math
|
|
106
76
|
*/
|
|
107
|
-
declare function sqrt<T extends number>(value: T):
|
|
77
|
+
declare function sqrt<T extends number>(value: T): Root<T, 2>;
|
|
108
78
|
/**
|
|
109
79
|
* Inverse the given value.
|
|
110
80
|
*
|
|
@@ -270,4 +240,4 @@ declare function acosh(value: Unitless): Radian;
|
|
|
270
240
|
*/
|
|
271
241
|
declare function atanh(value: Unitless): Radian;
|
|
272
242
|
|
|
273
|
-
export { abs, acos, acosh, add, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, div, eq, floor, gt, gte, inverse, lt, lte, max, min, mod, modSafe, mul, negate, pow, round, sin, sinh, sqrt, sub, sum, tan, tanh };
|
|
243
|
+
export { abs, acos, acosh, add, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, div, eq, floor, gt, gte, inverse, lt, lte, max, min, mod, modSafe, mul, negate, pow, root, round, sin, sinh, sqrt, sub, sum, tan, tanh };
|
package/dist/functions.mjs
CHANGED
|
@@ -58,13 +58,21 @@ function modSafe(a, b) {
|
|
|
58
58
|
function pow(base, exponent) {
|
|
59
59
|
return base ** exponent;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Take the nth root of a number.
|
|
63
|
+
*
|
|
64
|
+
* @category Math
|
|
65
|
+
*/
|
|
66
|
+
function root(base, exponent) {
|
|
67
|
+
return (base ** (1 / exponent));
|
|
68
|
+
}
|
|
61
69
|
/**
|
|
62
70
|
* Take the square root of the given value.
|
|
63
71
|
*
|
|
64
72
|
* @category Math
|
|
65
73
|
*/
|
|
66
74
|
function sqrt(value) {
|
|
67
|
-
return
|
|
75
|
+
return root(value, 2);
|
|
68
76
|
}
|
|
69
77
|
/**
|
|
70
78
|
* Inverse the given value.
|
|
@@ -285,4 +293,4 @@ function atanh(value) {
|
|
|
285
293
|
return Math.atanh(value);
|
|
286
294
|
}
|
|
287
295
|
|
|
288
|
-
export { abs, acos, acosh, add, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, div, eq, floor, gt, gte, inverse, lt, lte, max, min, mod, modSafe, mul, negate, pow, round, sin, sinh, sqrt, sub, sum, tan, tanh };
|
|
296
|
+
export { abs, acos, acosh, add, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, div, eq, floor, gt, gte, inverse, lt, lte, max, min, mod, modSafe, mul, negate, pow, root, round, sin, sinh, sqrt, sub, sum, tan, tanh };
|
package/dist/index.d.cts
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { E as Exponent, P as Pow, R as Root } from './_units.cjs';
|
|
2
|
+
export { A as AbstractUnit, a as AbstractUnitFrom, p as Divide, D as DivideExponents, q as DivideUnitSubvalues, I as Inverse, r as InverseUnitSubvalues, s as Multiply, M as MultiplyExponents, t as MultiplyUnitSubvalues, m as NegExponent, N as NegateExponent, l as NegativeExponent, n as PosExponent, u as PowUnitSubvalues, v as RootUnitSubvalues, S as SubExponents, o as SumExponents, U as Unit, b as UnitClass, c as UnitConversionRate, d as UnitConversionRateFrom, e as UnitFrom, f as UnitMeta, g as UnitSubvalues, h as UnknownAbstractUnit, i as UnknownUnit, j as UnknownUnitClass, k as UnknownUnitMeta } from './_units.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Multiple the exponent values of a unit by a number.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Use {@link Pow} instead.
|
|
8
|
+
*/
|
|
9
|
+
type MultiplyUnitExponents<T extends number, E extends Exponent> = Pow<T, E>;
|
|
10
|
+
/**
|
|
11
|
+
* Divide the exponent values of a unit by a number.
|
|
12
|
+
*
|
|
13
|
+
* @deprecated Use {@link Root} instead.
|
|
14
|
+
*/
|
|
15
|
+
type DivideUnitExponents<T extends number, E extends Exponent> = Root<T, E>;
|
|
16
|
+
|
|
17
|
+
export { DivideUnitExponents, Exponent, MultiplyUnitExponents, Pow, Root };
|
package/dist/index.d.mts
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { E as Exponent, P as Pow, R as Root } from './_units.mjs';
|
|
2
|
+
export { A as AbstractUnit, a as AbstractUnitFrom, p as Divide, D as DivideExponents, q as DivideUnitSubvalues, I as Inverse, r as InverseUnitSubvalues, s as Multiply, M as MultiplyExponents, t as MultiplyUnitSubvalues, m as NegExponent, N as NegateExponent, l as NegativeExponent, n as PosExponent, u as PowUnitSubvalues, v as RootUnitSubvalues, S as SubExponents, o as SumExponents, U as Unit, b as UnitClass, c as UnitConversionRate, d as UnitConversionRateFrom, e as UnitFrom, f as UnitMeta, g as UnitSubvalues, h as UnknownAbstractUnit, i as UnknownUnit, j as UnknownUnitClass, k as UnknownUnitMeta } from './_units.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Multiple the exponent values of a unit by a number.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Use {@link Pow} instead.
|
|
8
|
+
*/
|
|
9
|
+
type MultiplyUnitExponents<T extends number, E extends Exponent> = Pow<T, E>;
|
|
10
|
+
/**
|
|
11
|
+
* Divide the exponent values of a unit by a number.
|
|
12
|
+
*
|
|
13
|
+
* @deprecated Use {@link Root} instead.
|
|
14
|
+
*/
|
|
15
|
+
type DivideUnitExponents<T extends number, E extends Exponent> = Root<T, E>;
|
|
16
|
+
|
|
17
|
+
export { DivideUnitExponents, Exponent, MultiplyUnitExponents, Pow, Root };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { R as Radian, D as Degree, G as Gradian, T as Turn } from './_angle-plane.cjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { a5 as Square, M as Metre, q as Are, r as Hectare, $ as Second, a0 as Minute, a1 as Hour, a2 as Day, a3 as Week, a4 as Year, J as Joule, s as WattMinute, t as WattHour, H as Hertz, i as PerMinute, j as PerHour, k as PerDay, l as PerWeek, m as PerYear, G as Gram, C as Tonne, U as Celsius, S as Kelvin, a6 as Cubic, N as Litre } from './_time-duration.cjs';
|
|
3
|
+
import { i as UnknownUnit, s as Multiply, c as UnitConversionRate, U as Unit } from './_units.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Convert {@link Radian} to {@link Degree}.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { R as Radian, D as Degree, G as Gradian, T as Turn } from './_angle-plane.mjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { a5 as Square, M as Metre, q as Are, r as Hectare, $ as Second, a0 as Minute, a1 as Hour, a2 as Day, a3 as Week, a4 as Year, J as Joule, s as WattMinute, t as WattHour, H as Hertz, i as PerMinute, j as PerHour, k as PerDay, l as PerWeek, m as PerYear, G as Gram, C as Tonne, U as Celsius, S as Kelvin, a6 as Cubic, N as Litre } from './_time-duration.mjs';
|
|
3
|
+
import { i as UnknownUnit, s as Multiply, c as UnitConversionRate, U as Unit } from './_units.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Convert {@link Radian} to {@link Degree}.
|
package/dist/units.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { B as BaseUnitClass } from './_angle-plane.cjs';
|
|
2
2
|
export { D as Degree, G as Gradian, a as PlaneAngle, b as PlaneAngleUnit, P as PlaneAngleUnitClass, c as PlaneAngleUnitFrom, R as Radian, T as Turn } from './_angle-plane.cjs';
|
|
3
|
-
import {
|
|
4
|
-
import { R as ReciprocalUnitClass,
|
|
5
|
-
export {
|
|
3
|
+
import { a as AbstractUnitFrom, g as UnitSubvalues, f as UnitMeta, k as UnknownUnitMeta, e as UnitFrom, i as UnknownUnit, s as Multiply, U as Unit } from './_units.cjs';
|
|
4
|
+
import { R as ReciprocalUnitClass, a as Reciprocal, E as EnergyUnitClass, b as Energy, c as EnergyUnit, d as EnergyUnitFrom, J as Joule, T as TemperatureUnitClass, e as Temperature } from './_time-duration.cjs';
|
|
5
|
+
export { q as Are, n as Area, o as AreaUnit, A as AreaUnitClass, p as AreaUnitFrom, U as Celsius, a6 as Cubic, a2 as Day, Y as Duration, Z as DurationUnit, X as DurationUnitClass, _ as DurationUnitFrom, f as Frequency, g as FrequencyUnit, F as FrequencyUnitClass, h as FrequencyUnitFrom, G as Gram, r as Hectare, H as Hertz, a1 as Hour, S as Kelvin, u as Length, v as LengthUnit, L as LengthUnitClass, w as LengthUnitFrom, N as Litre, y as Mass, z as MassUnit, x as MassUnitClass, B as MassUnitFrom, M as Metre, a0 as Minute, k as PerDay, j as PerHour, i as PerMinute, P as PerSecond, l as PerWeek, m as PerYear, $ as Second, a5 as Square, O as TemperatureUnit, Q as TemperatureUnitFrom, C as Tonne, D as Volume, I as VolumeUnit, V as VolumeUnitClass, K as VolumeUnitFrom, t as WattHour, s as WattMinute, W as WattSecond, a3 as Week, a4 as Year } from './_time-duration.cjs';
|
|
6
6
|
export { a as Identity, b as IdentityUnit, I as IdentityUnitClass, c as IdentityUnitFrom, U as Unitless } from './_identity.cjs';
|
|
7
7
|
|
|
8
8
|
/**
|
package/dist/units.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { B as BaseUnitClass } from './_angle-plane.mjs';
|
|
2
2
|
export { D as Degree, G as Gradian, a as PlaneAngle, b as PlaneAngleUnit, P as PlaneAngleUnitClass, c as PlaneAngleUnitFrom, R as Radian, T as Turn } from './_angle-plane.mjs';
|
|
3
|
-
import {
|
|
4
|
-
import { R as ReciprocalUnitClass,
|
|
5
|
-
export {
|
|
3
|
+
import { a as AbstractUnitFrom, g as UnitSubvalues, f as UnitMeta, k as UnknownUnitMeta, e as UnitFrom, i as UnknownUnit, s as Multiply, U as Unit } from './_units.mjs';
|
|
4
|
+
import { R as ReciprocalUnitClass, a as Reciprocal, E as EnergyUnitClass, b as Energy, c as EnergyUnit, d as EnergyUnitFrom, J as Joule, T as TemperatureUnitClass, e as Temperature } from './_time-duration.mjs';
|
|
5
|
+
export { q as Are, n as Area, o as AreaUnit, A as AreaUnitClass, p as AreaUnitFrom, U as Celsius, a6 as Cubic, a2 as Day, Y as Duration, Z as DurationUnit, X as DurationUnitClass, _ as DurationUnitFrom, f as Frequency, g as FrequencyUnit, F as FrequencyUnitClass, h as FrequencyUnitFrom, G as Gram, r as Hectare, H as Hertz, a1 as Hour, S as Kelvin, u as Length, v as LengthUnit, L as LengthUnitClass, w as LengthUnitFrom, N as Litre, y as Mass, z as MassUnit, x as MassUnitClass, B as MassUnitFrom, M as Metre, a0 as Minute, k as PerDay, j as PerHour, i as PerMinute, P as PerSecond, l as PerWeek, m as PerYear, $ as Second, a5 as Square, O as TemperatureUnit, Q as TemperatureUnitFrom, C as Tonne, D as Volume, I as VolumeUnit, V as VolumeUnitClass, K as VolumeUnitFrom, t as WattHour, s as WattMinute, W as WattSecond, a3 as Week, a4 as Year } from './_time-duration.mjs';
|
|
6
6
|
export { a as Identity, b as IdentityUnit, I as IdentityUnitClass, c as IdentityUnitFrom, U as Unitless } from './_identity.mjs';
|
|
7
7
|
|
|
8
8
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uom-types",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Typesafe units with no runtime overhead.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"uom",
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"eslint-plugin-vitest": "0.2.8",
|
|
131
131
|
"http-serve": "1.0.1",
|
|
132
132
|
"husky": "8.0.3",
|
|
133
|
-
"knip": "2.19.
|
|
133
|
+
"knip": "2.19.1",
|
|
134
134
|
"lint-staged": "13.2.3",
|
|
135
135
|
"markdownlint-cli": "0.35.0",
|
|
136
136
|
"prettier": "3.0.1",
|
|
@@ -144,7 +144,6 @@
|
|
|
144
144
|
"ts-paths-esm-loader": "1.4.3",
|
|
145
145
|
"ts-plugin-type-coverage": "2.26.0",
|
|
146
146
|
"tsafe": "1.6.4",
|
|
147
|
-
"tsconfig-paths": "4.2.0",
|
|
148
147
|
"tsd": "0.28.1",
|
|
149
148
|
"type-coverage": "2.26.0",
|
|
150
149
|
"typedoc": "0.24.8",
|