@thi.ng/units 0.1.0 → 0.2.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 +17 -1
- package/README.md +87 -13
- package/api.d.ts +4 -0
- package/api.js +9 -0
- package/constants/din-sizes.d.ts +10 -0
- package/constants/din-sizes.js +11 -0
- package/constants/din.d.ts +10 -0
- package/constants/din.js +11 -0
- package/constants/velocities.d.ts +10 -0
- package/constants/velocities.js +11 -0
- package/index.d.ts +22 -19
- package/index.js +22 -19
- package/package.json +64 -45
- package/unit.d.ts +103 -21
- package/unit.js +113 -58
- package/units/accel.d.ts +5 -0
- package/{accel.js → units/accel.js} +1 -1
- package/units/angle.d.ts +8 -0
- package/{angle.js → units/angle.js} +1 -1
- package/units/area.d.ts +10 -0
- package/{area.js → units/area.js} +1 -1
- package/units/data.d.ts +25 -0
- package/{data.js → units/data.js} +1 -1
- package/units/density.d.ts +3 -0
- package/units/density.js +6 -0
- package/units/electric.d.ts +24 -0
- package/{electric.js → units/electric.js} +1 -1
- package/units/energy.d.ts +7 -0
- package/{energy.js → units/energy.js} +1 -1
- package/units/force.d.ts +2 -0
- package/{force.js → units/force.js} +1 -1
- package/units/frequency.d.ts +9 -0
- package/{frequency.js → units/frequency.js} +1 -1
- package/units/length.d.ts +20 -0
- package/{length.js → units/length.js} +1 -1
- package/units/luminous.d.ts +4 -0
- package/{luminous.js → units/luminous.js} +1 -1
- package/units/mass.d.ts +11 -0
- package/{mass.js → units/mass.js} +1 -1
- package/units/parts.d.ts +8 -0
- package/{parts.js → units/parts.js} +1 -1
- package/units/power.d.ts +9 -0
- package/{power.js → units/power.js} +1 -1
- package/units/pressure.d.ts +9 -0
- package/{pressure.js → units/pressure.js} +1 -1
- package/units/speed.d.ts +6 -0
- package/{speed.js → units/speed.js} +1 -1
- package/units/substance.d.ts +2 -0
- package/{substance.js → units/substance.js} +1 -1
- package/units/temperature.d.ts +4 -0
- package/{temperature.js → units/temperature.js} +1 -1
- package/units/time.d.ts +11 -0
- package/{time.js → units/time.js} +1 -1
- package/units/velocity.d.ts +6 -0
- package/units/velocity.js +8 -0
- package/units/volume.d.ts +15 -0
- package/{volume.js → units/volume.js} +1 -1
- package/accel.d.ts +0 -5
- package/angle.d.ts +0 -8
- package/area.d.ts +0 -10
- package/data.d.ts +0 -25
- package/electric.d.ts +0 -24
- package/energy.d.ts +0 -7
- package/force.d.ts +0 -2
- package/frequency.d.ts +0 -9
- package/length.d.ts +0 -20
- package/luminous.d.ts +0 -4
- package/mass.d.ts +0 -11
- package/parts.d.ts +0 -8
- package/power.d.ts +0 -9
- package/pressure.d.ts +0 -9
- package/speed.d.ts +0 -6
- package/substance.d.ts +0 -2
- package/temperature.d.ts +0 -4
- package/time.d.ts +0 -11
- package/volume.d.ts +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-03-
|
|
3
|
+
- **Last updated**: 2023-03-15T14:55:07Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,22 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [0.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/units@0.2.0) (2023-03-15)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add support for quantities ([94ded3e](https://github.com/thi-ng/umbrella/commit/94ded3e))
|
|
17
|
+
- add quantity()
|
|
18
|
+
- update various ops & predicates as polymorphic fns
|
|
19
|
+
- fix asUnit()
|
|
20
|
+
- update docs
|
|
21
|
+
- restructure /src, add quantities/constants ([1374162](https://github.com/thi-ng/umbrella/commit/1374162))
|
|
22
|
+
- add /src/constants:
|
|
23
|
+
- velocities
|
|
24
|
+
- DIN paper sizes
|
|
25
|
+
- move all unit presets to /src/units
|
|
26
|
+
- update pkg exports
|
|
27
|
+
|
|
12
28
|
## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/units@0.1.0) (2023-03-14)
|
|
13
29
|
|
|
14
30
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -35,6 +35,8 @@ This project is part of the
|
|
|
35
35
|
- [Using standard metric prefixes](#using-standard-metric-prefixes)
|
|
36
36
|
- [Unit combinators](#unit-combinators)
|
|
37
37
|
- [Unit conversions](#unit-conversions)
|
|
38
|
+
- [Quantities](#quantities)
|
|
39
|
+
- [Constants](#constants)
|
|
38
40
|
- [Status](#status)
|
|
39
41
|
- [Installation](#installation)
|
|
40
42
|
- [Dependencies](#dependencies)
|
|
@@ -44,10 +46,10 @@ This project is part of the
|
|
|
44
46
|
|
|
45
47
|
## About
|
|
46
48
|
|
|
47
|
-
Extensible SI unit creation, conversions & calculations (~
|
|
49
|
+
Extensible SI unit creation, conversions, quantities & calculations (incl. ~170 predefined units & constants).
|
|
48
50
|
|
|
49
|
-
All unit definitions & conversions are based on the SI unit system &
|
|
50
|
-
described here:
|
|
51
|
+
All unit definitions, quantities & conversions are based on the SI unit system &
|
|
52
|
+
concepts described here:
|
|
51
53
|
|
|
52
54
|
- https://en.wikipedia.org/wiki/International_System_of_Units
|
|
53
55
|
- https://en.wikipedia.org/wiki/SI_base_unit
|
|
@@ -55,6 +57,11 @@ described here:
|
|
|
55
57
|
- https://en.wikipedia.org/wiki/Coherence_(units_of_measurement)
|
|
56
58
|
- https://en.wikipedia.org/wiki/Metric_prefix
|
|
57
59
|
|
|
60
|
+
The overall conversion approach is inspired & partially based on:
|
|
61
|
+
|
|
62
|
+
- [Frink](https://frinklang.org/)
|
|
63
|
+
- [@g7s/unit](https://github.com/g7s/unit)
|
|
64
|
+
|
|
58
65
|
### Unit definitions
|
|
59
66
|
|
|
60
67
|
Each unit is defined via a 7-dimensional vector representing individual
|
|
@@ -111,8 +118,9 @@ units](https://en.wikipedia.org/wiki/SI_derived_unit)):
|
|
|
111
118
|
|
|
112
119
|
> Ω = kg⋅m<sup>2</sup>⋅s<sup>−3</sup>⋅A<sup>−2</sup>
|
|
113
120
|
|
|
114
|
-
Btw. The
|
|
115
|
-
|
|
121
|
+
Btw. The
|
|
122
|
+
[`formatSI()`](https://docs.thi.ng/umbrella/units/functions/formatSI.html)
|
|
123
|
+
function can be used to format a unit's dimension vector:
|
|
116
124
|
|
|
117
125
|
```ts
|
|
118
126
|
formatSI(div(V, A));
|
|
@@ -385,9 +393,9 @@ https://en.wikipedia.org/wiki/Parts-per_notation
|
|
|
385
393
|
|
|
386
394
|
#### Using standard metric prefixes
|
|
387
395
|
|
|
388
|
-
Existing
|
|
389
|
-
[prefixed](https://docs.thi.ng/umbrella/units/functions/prefix-1.html) to
|
|
390
|
-
derived versions:
|
|
396
|
+
Existing coherent units can be
|
|
397
|
+
[prefixed](https://docs.thi.ng/umbrella/units/functions/prefix-1.html) to
|
|
398
|
+
produce derived versions:
|
|
391
399
|
|
|
392
400
|
```ts
|
|
393
401
|
// define micrometer (also available as preset)
|
|
@@ -402,7 +410,7 @@ prefix("k", Hz);
|
|
|
402
410
|
#### Unit combinators
|
|
403
411
|
|
|
404
412
|
The following combinators can be used to derive scaled and/or more complex units
|
|
405
|
-
in multiple SI dimensions:
|
|
413
|
+
(or [quantities](#quantities)) in multiple SI dimensions:
|
|
406
414
|
|
|
407
415
|
- [`div(a, b)`](https://docs.thi.ng/umbrella/units/functions/div.html): derives
|
|
408
416
|
a new unit via the division of the given units
|
|
@@ -433,9 +441,12 @@ const Hz = reciprocal(s);
|
|
|
433
441
|
|
|
434
442
|
### Unit conversions
|
|
435
443
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
444
|
+
Units (and [quantities](#quantities)) can be converted using
|
|
445
|
+
[`convert()`](https://docs.thi.ng/umbrella/units/functions/convert.html). Only
|
|
446
|
+
units with compatible (incl. reciprocal) dimensions can be converted, otherwise
|
|
447
|
+
an error will be thrown. On the other hand, all _dimensionless_ units can be
|
|
448
|
+
converted to other _dimensionless_ units (even if it would be semantic
|
|
449
|
+
nonsense).
|
|
439
450
|
|
|
440
451
|
Units can be specified in various ways:
|
|
441
452
|
|
|
@@ -467,6 +478,68 @@ convert(10, "arcsec", "rad") * R;
|
|
|
467
478
|
// 308.87479623488537
|
|
468
479
|
```
|
|
469
480
|
|
|
481
|
+
### Quantities
|
|
482
|
+
|
|
483
|
+
The library also supports defining quantities, i.e. certain finite amounts of a
|
|
484
|
+
given unit. These can be a number or vector-based and can be used for
|
|
485
|
+
calculations & conversions using the above mentioned polymorphic functions:
|
|
486
|
+
`div()`, `mul()`, `reciprocal()` and `convert()`.
|
|
487
|
+
|
|
488
|
+
Quantities are created via
|
|
489
|
+
[`quantity()`](https://docs.thi.ng/umbrella/units/functions/quantity-1.html)
|
|
490
|
+
which acts a factory function for a thin `Quantity` class wrapper. The latter
|
|
491
|
+
also implements the standard
|
|
492
|
+
[`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html) interface
|
|
493
|
+
to obtain the unwrapped amount (though it only should be used for dimensionless
|
|
494
|
+
quantities). Use [`convert()`](#unit-conversions) otherwise!
|
|
495
|
+
|
|
496
|
+
```ts
|
|
497
|
+
// (also available as preset)
|
|
498
|
+
const speedOfLight = quantity(299792458, "m/s");
|
|
499
|
+
|
|
500
|
+
// compute wavelength of a WiFi signal in millimeters
|
|
501
|
+
convert(div(speedOfLight, quantity(2.4,"GHz")), "mm");
|
|
502
|
+
// 124.9135
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
```ts
|
|
506
|
+
// DIN A4 paper size (also available as preset)
|
|
507
|
+
const A4 = quantity([210, 297], "mm");
|
|
508
|
+
|
|
509
|
+
// convert paper size to inches
|
|
510
|
+
convert(A4, "in");
|
|
511
|
+
// [ 8.2677, 11.6929 ]
|
|
512
|
+
|
|
513
|
+
// or calculate pixel dimensions @ 300 dpi
|
|
514
|
+
// the result of the product is dimensionless
|
|
515
|
+
// so we use the NONE preset as target unit...
|
|
516
|
+
convert(mul(A4, quantity(300, "dpi")), NONE)
|
|
517
|
+
// [ 2480.314960629921, 3507.8740157480315 ]
|
|
518
|
+
|
|
519
|
+
// alternatively dimensionless units can be deref'd directly
|
|
520
|
+
mul(A4, quantity(300, "dpi")).deref()
|
|
521
|
+
// [ 2480.314960629921, 3507.8740157480315 ]
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
When combining different quantities, their units do not need to be the same:
|
|
525
|
+
|
|
526
|
+
```ts
|
|
527
|
+
// compute 10 mm x 2 inch and convert to square centimeter
|
|
528
|
+
convert(mul(quantity(10, "mm"), quantity(2, "in")), "cm2")
|
|
529
|
+
// 5.08
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
#### Constants
|
|
533
|
+
|
|
534
|
+
The following constants are provided (more to come):
|
|
535
|
+
|
|
536
|
+
| Var name | Unit |
|
|
537
|
+
|---------------------------|----------------|
|
|
538
|
+
| `DIN_A0` ... `DIN_A8` | `["mm", "mm"]` |
|
|
539
|
+
| `SPEED_OF_LIGHT` | `"m/s"` |
|
|
540
|
+
| `SPEED_OF_SOUND_IN_AIR` | `"m/s"` |
|
|
541
|
+
| `SPEED_OF_SOUND_IN_WATER` | `"m/s"` |
|
|
542
|
+
|
|
470
543
|
## Status
|
|
471
544
|
|
|
472
545
|
**BETA** - possibly breaking changes forthcoming
|
|
@@ -493,10 +566,11 @@ For Node.js REPL:
|
|
|
493
566
|
const units = await import("@thi.ng/units");
|
|
494
567
|
```
|
|
495
568
|
|
|
496
|
-
Package sizes (brotli'd, pre-treeshake): ESM:
|
|
569
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 4.05 KB
|
|
497
570
|
|
|
498
571
|
## Dependencies
|
|
499
572
|
|
|
573
|
+
- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/develop/packages/api)
|
|
500
574
|
- [@thi.ng/checks](https://github.com/thi-ng/umbrella/tree/develop/packages/checks)
|
|
501
575
|
- [@thi.ng/equiv](https://github.com/thi-ng/umbrella/tree/develop/packages/equiv)
|
|
502
576
|
- [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/develop/packages/errors)
|
package/api.d.ts
CHANGED
package/api.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const DIN_A0: import("../unit.js").Quantity<number[]>;
|
|
2
|
+
export declare const DIN_A1: import("../unit.js").Quantity<number[]>;
|
|
3
|
+
export declare const DIN_A2: import("../unit.js").Quantity<number[]>;
|
|
4
|
+
export declare const DIN_A3: import("../unit.js").Quantity<number[]>;
|
|
5
|
+
export declare const DIN_A4: import("../unit.js").Quantity<number[]>;
|
|
6
|
+
export declare const DIN_A5: import("../unit.js").Quantity<number[]>;
|
|
7
|
+
export declare const DIN_A6: import("../unit.js").Quantity<number[]>;
|
|
8
|
+
export declare const DIN_A7: import("../unit.js").Quantity<number[]>;
|
|
9
|
+
export declare const DIN_A8: import("../unit.js").Quantity<number[]>;
|
|
10
|
+
//# sourceMappingURL=din-sizes.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { mm } from "../units/length.js";
|
|
2
|
+
import { quantity } from "../unit.js";
|
|
3
|
+
export const DIN_A0 = quantity([841, 1189], mm);
|
|
4
|
+
export const DIN_A1 = quantity([594, 841], mm);
|
|
5
|
+
export const DIN_A2 = quantity([420, 594], mm);
|
|
6
|
+
export const DIN_A3 = quantity([297, 420], mm);
|
|
7
|
+
export const DIN_A4 = quantity([210, 297], mm);
|
|
8
|
+
export const DIN_A5 = quantity([148, 210], mm);
|
|
9
|
+
export const DIN_A6 = quantity([105, 148], mm);
|
|
10
|
+
export const DIN_A7 = quantity([74, 105], mm);
|
|
11
|
+
export const DIN_A8 = quantity([52, 74], mm);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const DIN_A0: import("../unit.js").Value<number[]>;
|
|
2
|
+
export declare const DIN_A1: import("../unit.js").Value<number[]>;
|
|
3
|
+
export declare const DIN_A2: import("../unit.js").Value<number[]>;
|
|
4
|
+
export declare const DIN_A3: import("../unit.js").Value<number[]>;
|
|
5
|
+
export declare const DIN_A4: import("../unit.js").Value<number[]>;
|
|
6
|
+
export declare const DIN_A5: import("../unit.js").Value<number[]>;
|
|
7
|
+
export declare const DIN_A6: import("../unit.js").Value<number[]>;
|
|
8
|
+
export declare const DIN_A7: import("../unit.js").Value<number[]>;
|
|
9
|
+
export declare const DIN_A8: import("../unit.js").Value<number[]>;
|
|
10
|
+
//# sourceMappingURL=din.d.ts.map
|
package/constants/din.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { mm } from "../length.js";
|
|
2
|
+
import { value } from "../unit.js";
|
|
3
|
+
export const DIN_A0 = value([841, 1189], mm);
|
|
4
|
+
export const DIN_A1 = value([594, 841], mm);
|
|
5
|
+
export const DIN_A2 = value([420, 594], mm);
|
|
6
|
+
export const DIN_A3 = value([297, 420], mm);
|
|
7
|
+
export const DIN_A4 = value([210, 297], mm);
|
|
8
|
+
export const DIN_A5 = value([148, 210], mm);
|
|
9
|
+
export const DIN_A6 = value([105, 148], mm);
|
|
10
|
+
export const DIN_A7 = value([74, 105], mm);
|
|
11
|
+
export const DIN_A8 = value([52, 74], mm);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const SPEED_OF_LIGHT: import("../unit.js").Quantity<299792458>;
|
|
2
|
+
/**
|
|
3
|
+
* At 20 degree celsius
|
|
4
|
+
*/
|
|
5
|
+
export declare const SPEED_OF_SOUND_IN_AIR: import("../unit.js").Quantity<343.14>;
|
|
6
|
+
/**
|
|
7
|
+
* At 20 degree celsius
|
|
8
|
+
*/
|
|
9
|
+
export declare const SPEED_OF_SOUND_IN_WATER: import("../unit.js").Quantity<1482>;
|
|
10
|
+
//# sourceMappingURL=velocities.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { quantity } from "../unit.js";
|
|
2
|
+
import { m_s } from "../units/velocity.js";
|
|
3
|
+
export const SPEED_OF_LIGHT = quantity(299792458, m_s);
|
|
4
|
+
/**
|
|
5
|
+
* At 20 degree celsius
|
|
6
|
+
*/
|
|
7
|
+
export const SPEED_OF_SOUND_IN_AIR = quantity(343.14, m_s);
|
|
8
|
+
/**
|
|
9
|
+
* At 20 degree celsius
|
|
10
|
+
*/
|
|
11
|
+
export const SPEED_OF_SOUND_IN_WATER = quantity(1482, m_s);
|
package/index.d.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
export * from "./api.js";
|
|
2
2
|
export * from "./unit.js";
|
|
3
|
-
export * from "./accel.js";
|
|
4
|
-
export * from "./angle.js";
|
|
5
|
-
export * from "./area.js";
|
|
6
|
-
export * from "./data.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./substance.js";
|
|
19
|
-
export * from "./temperature.js";
|
|
20
|
-
export * from "./time.js";
|
|
21
|
-
export * from "./
|
|
3
|
+
export * from "./units/accel.js";
|
|
4
|
+
export * from "./units/angle.js";
|
|
5
|
+
export * from "./units/area.js";
|
|
6
|
+
export * from "./units/data.js";
|
|
7
|
+
export * from "./units/density.js";
|
|
8
|
+
export * from "./units/electric.js";
|
|
9
|
+
export * from "./units/energy.js";
|
|
10
|
+
export * from "./units/force.js";
|
|
11
|
+
export * from "./units/frequency.js";
|
|
12
|
+
export * from "./units/length.js";
|
|
13
|
+
export * from "./units/luminous.js";
|
|
14
|
+
export * from "./units/mass.js";
|
|
15
|
+
export * from "./units/parts.js";
|
|
16
|
+
export * from "./units/power.js";
|
|
17
|
+
export * from "./units/pressure.js";
|
|
18
|
+
export * from "./units/substance.js";
|
|
19
|
+
export * from "./units/temperature.js";
|
|
20
|
+
export * from "./units/time.js";
|
|
21
|
+
export * from "./units/velocity.js";
|
|
22
|
+
export * from "./units/volume.js";
|
|
23
|
+
export * from "./constants/din-sizes.js";
|
|
24
|
+
export * from "./constants/velocities.js";
|
|
22
25
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
export * from "./api.js";
|
|
2
2
|
export * from "./unit.js";
|
|
3
|
-
export * from "./accel.js";
|
|
4
|
-
export * from "./angle.js";
|
|
5
|
-
export * from "./area.js";
|
|
6
|
-
export * from "./data.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./substance.js";
|
|
19
|
-
export * from "./temperature.js";
|
|
20
|
-
export * from "./time.js";
|
|
21
|
-
export * from "./
|
|
3
|
+
export * from "./units/accel.js";
|
|
4
|
+
export * from "./units/angle.js";
|
|
5
|
+
export * from "./units/area.js";
|
|
6
|
+
export * from "./units/data.js";
|
|
7
|
+
export * from "./units/density.js";
|
|
8
|
+
export * from "./units/electric.js";
|
|
9
|
+
export * from "./units/energy.js";
|
|
10
|
+
export * from "./units/force.js";
|
|
11
|
+
export * from "./units/frequency.js";
|
|
12
|
+
export * from "./units/length.js";
|
|
13
|
+
export * from "./units/luminous.js";
|
|
14
|
+
export * from "./units/mass.js";
|
|
15
|
+
export * from "./units/parts.js";
|
|
16
|
+
export * from "./units/power.js";
|
|
17
|
+
export * from "./units/pressure.js";
|
|
18
|
+
export * from "./units/substance.js";
|
|
19
|
+
export * from "./units/temperature.js";
|
|
20
|
+
export * from "./units/time.js";
|
|
21
|
+
export * from "./units/velocity.js";
|
|
22
|
+
export * from "./units/volume.js";
|
|
23
|
+
export * from "./constants/din-sizes.js";
|
|
24
|
+
export * from "./constants/velocities.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/units",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Extensible SI unit creation, conversions & calculations (~
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Extensible SI unit creation, conversions, quantities & calculations (incl. ~170 predefined units & constants)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
7
7
|
"typings": "./index.d.ts",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@thi.ng/api": "^8.7.4",
|
|
37
38
|
"@thi.ng/checks": "^3.3.10",
|
|
38
39
|
"@thi.ng/equiv": "^2.1.20",
|
|
39
40
|
"@thi.ng/errors": "^2.2.13"
|
|
@@ -52,23 +53,27 @@
|
|
|
52
53
|
"area",
|
|
53
54
|
"bits",
|
|
54
55
|
"bytes",
|
|
56
|
+
"calculation",
|
|
55
57
|
"capacitance",
|
|
56
58
|
"current",
|
|
57
59
|
"voltage",
|
|
58
60
|
"resistance",
|
|
59
|
-
"
|
|
61
|
+
"conversion",
|
|
60
62
|
"energy",
|
|
61
63
|
"force",
|
|
62
64
|
"frequency",
|
|
63
65
|
"length",
|
|
64
66
|
"mass",
|
|
67
|
+
"math",
|
|
65
68
|
"power",
|
|
66
69
|
"si",
|
|
67
70
|
"speed",
|
|
71
|
+
"symbolic",
|
|
68
72
|
"temperature",
|
|
69
73
|
"time",
|
|
70
74
|
"typescript",
|
|
71
75
|
"units",
|
|
76
|
+
"velocity",
|
|
72
77
|
"volume"
|
|
73
78
|
],
|
|
74
79
|
"publishConfig": {
|
|
@@ -83,76 +88,90 @@
|
|
|
83
88
|
},
|
|
84
89
|
"files": [
|
|
85
90
|
"./*.js",
|
|
86
|
-
"./*.d.ts"
|
|
91
|
+
"./*.d.ts",
|
|
92
|
+
"constants",
|
|
93
|
+
"units"
|
|
87
94
|
],
|
|
88
95
|
"exports": {
|
|
89
96
|
".": {
|
|
90
97
|
"default": "./index.js"
|
|
91
98
|
},
|
|
92
|
-
"./accel": {
|
|
93
|
-
"default": "./accel.js"
|
|
94
|
-
},
|
|
95
|
-
"./angle": {
|
|
96
|
-
"default": "./angle.js"
|
|
97
|
-
},
|
|
98
99
|
"./api": {
|
|
99
100
|
"default": "./api.js"
|
|
100
101
|
},
|
|
101
|
-
"./
|
|
102
|
-
"default": "./
|
|
102
|
+
"./constants/din-sizes": {
|
|
103
|
+
"default": "./constants/din-sizes.js"
|
|
103
104
|
},
|
|
104
|
-
"./
|
|
105
|
-
"default": "./
|
|
105
|
+
"./constants/velocities": {
|
|
106
|
+
"default": "./constants/velocities.js"
|
|
106
107
|
},
|
|
107
|
-
"./
|
|
108
|
-
"default": "./
|
|
108
|
+
"./unit": {
|
|
109
|
+
"default": "./unit.js"
|
|
109
110
|
},
|
|
110
|
-
"./
|
|
111
|
-
"default": "./
|
|
111
|
+
"./units/accel": {
|
|
112
|
+
"default": "./units/accel.js"
|
|
112
113
|
},
|
|
113
|
-
"./
|
|
114
|
-
"default": "./
|
|
114
|
+
"./units/angle": {
|
|
115
|
+
"default": "./units/angle.js"
|
|
115
116
|
},
|
|
116
|
-
"./
|
|
117
|
-
"default": "./
|
|
117
|
+
"./units/area": {
|
|
118
|
+
"default": "./units/area.js"
|
|
118
119
|
},
|
|
119
|
-
"./
|
|
120
|
-
"default": "./
|
|
120
|
+
"./units/data": {
|
|
121
|
+
"default": "./units/data.js"
|
|
121
122
|
},
|
|
122
|
-
"./
|
|
123
|
-
"default": "./
|
|
123
|
+
"./units/density": {
|
|
124
|
+
"default": "./units/density.js"
|
|
124
125
|
},
|
|
125
|
-
"./
|
|
126
|
-
"default": "./
|
|
126
|
+
"./units/electric": {
|
|
127
|
+
"default": "./units/electric.js"
|
|
127
128
|
},
|
|
128
|
-
"./
|
|
129
|
-
"default": "./
|
|
129
|
+
"./units/energy": {
|
|
130
|
+
"default": "./units/energy.js"
|
|
130
131
|
},
|
|
131
|
-
"./
|
|
132
|
-
"default": "./
|
|
132
|
+
"./units/force": {
|
|
133
|
+
"default": "./units/force.js"
|
|
133
134
|
},
|
|
134
|
-
"./
|
|
135
|
-
"default": "./
|
|
135
|
+
"./units/frequency": {
|
|
136
|
+
"default": "./units/frequency.js"
|
|
136
137
|
},
|
|
137
|
-
"./
|
|
138
|
-
"default": "./
|
|
138
|
+
"./units/length": {
|
|
139
|
+
"default": "./units/length.js"
|
|
139
140
|
},
|
|
140
|
-
"./
|
|
141
|
-
"default": "./
|
|
141
|
+
"./units/luminous": {
|
|
142
|
+
"default": "./units/luminous.js"
|
|
142
143
|
},
|
|
143
|
-
"./
|
|
144
|
-
"default": "./
|
|
144
|
+
"./units/mass": {
|
|
145
|
+
"default": "./units/mass.js"
|
|
145
146
|
},
|
|
146
|
-
"./
|
|
147
|
-
"default": "./
|
|
147
|
+
"./units/parts": {
|
|
148
|
+
"default": "./units/parts.js"
|
|
149
|
+
},
|
|
150
|
+
"./units/power": {
|
|
151
|
+
"default": "./units/power.js"
|
|
152
|
+
},
|
|
153
|
+
"./units/pressure": {
|
|
154
|
+
"default": "./units/pressure.js"
|
|
155
|
+
},
|
|
156
|
+
"./units/substance": {
|
|
157
|
+
"default": "./units/substance.js"
|
|
158
|
+
},
|
|
159
|
+
"./units/temperature": {
|
|
160
|
+
"default": "./units/temperature.js"
|
|
161
|
+
},
|
|
162
|
+
"./units/time": {
|
|
163
|
+
"default": "./units/time.js"
|
|
164
|
+
},
|
|
165
|
+
"./units/velocity": {
|
|
166
|
+
"default": "./units/velocity.js"
|
|
148
167
|
},
|
|
149
|
-
"./volume": {
|
|
150
|
-
"default": "./volume.js"
|
|
168
|
+
"./units/volume": {
|
|
169
|
+
"default": "./units/volume.js"
|
|
151
170
|
}
|
|
152
171
|
},
|
|
153
172
|
"thi.ng": {
|
|
154
173
|
"status": "beta",
|
|
155
174
|
"year": 2021
|
|
156
175
|
},
|
|
157
|
-
"gitHead": "
|
|
176
|
+
"gitHead": "ded6c346ccabc8bf647b848738878bdae8e05d55\n"
|
|
158
177
|
}
|