@thi.ng/units 0.1.1 → 0.3.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 +23 -1
- package/README.md +131 -25
- package/api.d.ts +4 -0
- package/api.js +9 -0
- package/constants/densities.d.ts +25 -0
- package/constants/densities.js +28 -0
- package/constants/din-sizes.d.ts +10 -0
- package/constants/din-sizes.js +12 -0
- package/constants/din.d.ts +10 -0
- package/constants/din.js +11 -0
- package/constants/earth.d.ts +33 -0
- package/constants/earth.js +35 -0
- package/constants/velocities.d.ts +13 -0
- package/constants/velocities.js +14 -0
- package/index.d.ts +24 -19
- package/index.js +24 -19
- package/package.json +70 -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-16T08:47:43Z
|
|
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,28 @@ 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.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/units@0.3.0) (2023-03-16)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add more quantities/constants ([27cd71e](https://github.com/thi-ng/umbrella/commit/27cd71e))
|
|
17
|
+
|
|
18
|
+
## [0.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/units@0.2.0) (2023-03-15)
|
|
19
|
+
|
|
20
|
+
#### 🚀 Features
|
|
21
|
+
|
|
22
|
+
- add support for quantities ([94ded3e](https://github.com/thi-ng/umbrella/commit/94ded3e))
|
|
23
|
+
- add quantity()
|
|
24
|
+
- update various ops & predicates as polymorphic fns
|
|
25
|
+
- fix asUnit()
|
|
26
|
+
- update docs
|
|
27
|
+
- restructure /src, add quantities/constants ([1374162](https://github.com/thi-ng/umbrella/commit/1374162))
|
|
28
|
+
- add /src/constants:
|
|
29
|
+
- velocities
|
|
30
|
+
- DIN paper sizes
|
|
31
|
+
- move all unit presets to /src/units
|
|
32
|
+
- update pkg exports
|
|
33
|
+
|
|
12
34
|
## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/units@0.1.0) (2023-03-14)
|
|
13
35
|
|
|
14
36
|
#### 🚀 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,7 +57,10 @@ described here:
|
|
|
55
57
|
- https://en.wikipedia.org/wiki/Coherence_(units_of_measurement)
|
|
56
58
|
- https://en.wikipedia.org/wiki/Metric_prefix
|
|
57
59
|
|
|
58
|
-
The overall conversion approach is based on
|
|
60
|
+
The overall conversion approach is inspired & partially based on:
|
|
61
|
+
|
|
62
|
+
- [Frink](https://frinklang.org/)
|
|
63
|
+
- [@g7s/unit](https://github.com/g7s/unit)
|
|
59
64
|
|
|
60
65
|
### Unit definitions
|
|
61
66
|
|
|
@@ -83,7 +88,7 @@ For example, here's how we can define kilograms and meters:
|
|
|
83
88
|
|
|
84
89
|
```ts
|
|
85
90
|
// kilogram, SI dimension 0
|
|
86
|
-
const KG = coherent(
|
|
91
|
+
const KG = coherent(0);
|
|
87
92
|
// { dim: [ 1, 0, 0, 0, 0, 0, 0 ], scale: 1, offset: 0, coherent: true }
|
|
88
93
|
|
|
89
94
|
// meters, SI dimension 1
|
|
@@ -113,8 +118,9 @@ units](https://en.wikipedia.org/wiki/SI_derived_unit)):
|
|
|
113
118
|
|
|
114
119
|
> Ω = kg⋅m<sup>2</sup>⋅s<sup>−3</sup>⋅A<sup>−2</sup>
|
|
115
120
|
|
|
116
|
-
Btw. The
|
|
117
|
-
|
|
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:
|
|
118
124
|
|
|
119
125
|
```ts
|
|
120
126
|
formatSI(div(V, A));
|
|
@@ -290,15 +296,15 @@ The following units are provided as "builtins", here grouped by dimension:
|
|
|
290
296
|
|
|
291
297
|
https://en.wikipedia.org/wiki/Parts-per_notation
|
|
292
298
|
|
|
293
|
-
| Unit name | Variable name | Description
|
|
294
|
-
|
|
295
|
-
| `%` | `percent` | part per hundred
|
|
296
|
-
| `‰` | `permille` | part per thousand
|
|
297
|
-
| `‱` | `permyriad` | part per ten thousand
|
|
298
|
-
| `pcm` | `pcm` | part per
|
|
299
|
-
| `ppm` | `ppm` | part per million
|
|
300
|
-
| `ppb` | `ppb` | part per billion
|
|
301
|
-
| `ppt` | `ppt` | part per trillion
|
|
299
|
+
| Unit name | Variable name | Description |
|
|
300
|
+
|-----------|---------------|---------------------------|
|
|
301
|
+
| `%` | `percent` | part per hundred |
|
|
302
|
+
| `‰` | `permille` | part per thousand |
|
|
303
|
+
| `‱` | `permyriad` | part per ten thousand |
|
|
304
|
+
| `pcm` | `pcm` | part per hundred thousand |
|
|
305
|
+
| `ppm` | `ppm` | part per million |
|
|
306
|
+
| `ppb` | `ppb` | part per billion |
|
|
307
|
+
| `ppt` | `ppt` | part per trillion |
|
|
302
308
|
|
|
303
309
|
#### Power
|
|
304
310
|
|
|
@@ -387,9 +393,9 @@ https://en.wikipedia.org/wiki/Parts-per_notation
|
|
|
387
393
|
|
|
388
394
|
#### Using standard metric prefixes
|
|
389
395
|
|
|
390
|
-
Existing
|
|
391
|
-
[prefixed](https://docs.thi.ng/umbrella/units/functions/prefix-1.html) to
|
|
392
|
-
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:
|
|
393
399
|
|
|
394
400
|
```ts
|
|
395
401
|
// define micrometer (also available as preset)
|
|
@@ -404,7 +410,7 @@ prefix("k", Hz);
|
|
|
404
410
|
#### Unit combinators
|
|
405
411
|
|
|
406
412
|
The following combinators can be used to derive scaled and/or more complex units
|
|
407
|
-
in multiple SI dimensions:
|
|
413
|
+
(or [quantities](#quantities)) in multiple SI dimensions:
|
|
408
414
|
|
|
409
415
|
- [`div(a, b)`](https://docs.thi.ng/umbrella/units/functions/div.html): derives
|
|
410
416
|
a new unit via the division of the given units
|
|
@@ -435,9 +441,12 @@ const Hz = reciprocal(s);
|
|
|
435
441
|
|
|
436
442
|
### Unit conversions
|
|
437
443
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
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).
|
|
441
450
|
|
|
442
451
|
Units can be specified in various ways:
|
|
443
452
|
|
|
@@ -463,12 +472,108 @@ Another example using dimensionless units (here angles, arc second ⇒ radian) t
|
|
|
463
472
|
compute the distance of 10 arcsec on the earth surface (in meters):
|
|
464
473
|
|
|
465
474
|
```ts
|
|
466
|
-
|
|
475
|
+
// earth radius in meters
|
|
476
|
+
// (also available as quantity EARTH_RADIUS, see section below)
|
|
477
|
+
const R = 6371000;
|
|
467
478
|
|
|
468
479
|
convert(10, "arcsec", "rad") * R;
|
|
469
480
|
// 308.87479623488537
|
|
470
481
|
```
|
|
471
482
|
|
|
483
|
+
### Quantities
|
|
484
|
+
|
|
485
|
+
The library also supports defining quantities, i.e. certain finite amounts of a
|
|
486
|
+
given unit. These can be a number or vector-based and can be used for
|
|
487
|
+
calculations & conversions using the above mentioned polymorphic functions:
|
|
488
|
+
`div()`, `mul()`, `reciprocal()` and `convert()`.
|
|
489
|
+
|
|
490
|
+
Quantities are created via
|
|
491
|
+
[`quantity()`](https://docs.thi.ng/umbrella/units/functions/quantity-1.html)
|
|
492
|
+
which acts as factory function for a thin `Quantity` class wrapper. The latter
|
|
493
|
+
also implements the standard
|
|
494
|
+
[`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html) interface
|
|
495
|
+
to obtain the unwrapped amount (though it only should be used for dimensionless
|
|
496
|
+
quantities). Use [`convert()`](#unit-conversions) otherwise!
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
// (also available as preset)
|
|
500
|
+
const speedOfLight = quantity(299792458, "m/s");
|
|
501
|
+
|
|
502
|
+
// compute wavelength of a WiFi signal in millimeters
|
|
503
|
+
convert(div(speedOfLight, quantity(2.4,"GHz")), "mm");
|
|
504
|
+
// 124.9135
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
Some examples using vector quantities:
|
|
508
|
+
|
|
509
|
+
```ts
|
|
510
|
+
// DIN A4 paper size (also available as preset)
|
|
511
|
+
const A4 = quantity([210, 297], "mm");
|
|
512
|
+
|
|
513
|
+
// convert paper size to inches
|
|
514
|
+
convert(A4, "in");
|
|
515
|
+
// [ 8.2677, 11.6929 ]
|
|
516
|
+
|
|
517
|
+
// or calculate pixel dimensions @ 300 dpi
|
|
518
|
+
// the result of this product is dimensionless,
|
|
519
|
+
// so we use the NONE preset as target unit...
|
|
520
|
+
convert(mul(A4, quantity(300, "dpi")), NONE)
|
|
521
|
+
// [ 2480.314960629921, 3507.8740157480315 ]
|
|
522
|
+
|
|
523
|
+
// alternatively, dimensionless units can be deref'd directly
|
|
524
|
+
mul(A4, quantity(300, "dpi")).deref()
|
|
525
|
+
// [ 2480.314960629921, 3507.8740157480315 ]
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
When combining different quantities, their units do not need to be the same:
|
|
529
|
+
|
|
530
|
+
```ts
|
|
531
|
+
// compute 10 mm x 2 inch and convert to square centimeter
|
|
532
|
+
convert(mul(quantity(10, "mm"), quantity(2, "in")), "cm2")
|
|
533
|
+
// 5.08
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
#### Constants
|
|
537
|
+
|
|
538
|
+
The following constants are provided (more to come):
|
|
539
|
+
|
|
540
|
+
| Var name | Unit | Comment |
|
|
541
|
+
|---------------------------|-------------------|------------------------|
|
|
542
|
+
| `DIN_A0` ... `DIN_A8` | 2d vector of `mm` | Paper sizes |
|
|
543
|
+
| `EARTH_GRAVITY` | `m/s` | |
|
|
544
|
+
| `EARTH_CIRCUMFERENCE` | `m` | |
|
|
545
|
+
| `EARTH_MASS` | `kg` | |
|
|
546
|
+
| `EARTH_RADIUS` | `m` | |
|
|
547
|
+
| `GRAVITATION` | `kg-1·m3·s-2` | Gravitational constant |
|
|
548
|
+
| `SPEED_OF_LIGHT` | `m/s` | |
|
|
549
|
+
| `SPEED_OF_SOUND_IN_AIR` | `m/s` | at 20 ℃ |
|
|
550
|
+
| `SPEED_OF_SOUND_IN_WATER` | `m/s` | at 20 ℃ |
|
|
551
|
+
|
|
552
|
+
Densities of selected materials:
|
|
553
|
+
|
|
554
|
+
| Var name | Unit |
|
|
555
|
+
|--------------|---------|
|
|
556
|
+
| `AIR` | `kg/m3` |
|
|
557
|
+
| `ALUMINIUM` | `kg/m3` |
|
|
558
|
+
| `CONCRETE` | `kg/m3` |
|
|
559
|
+
| `COPPER` | `kg/m3` |
|
|
560
|
+
| `DIAMOND` | `kg/m3` |
|
|
561
|
+
| `GLASS` | `kg/m3` |
|
|
562
|
+
| `GOLD` | `kg/m3` |
|
|
563
|
+
| `ICE` | `kg/m3` |
|
|
564
|
+
| `IRON` | `kg/m3` |
|
|
565
|
+
| `NYLON` | `kg/m3` |
|
|
566
|
+
| `PLASTIC` | `kg/m3` |
|
|
567
|
+
| `PLATINUM` | `kg/m3` |
|
|
568
|
+
| `SAND` | `kg/m3` |
|
|
569
|
+
| `SALT_WATER` | `kg/m3` |
|
|
570
|
+
| `SILICON` | `kg/m3` |
|
|
571
|
+
| `SILVER` | `kg/m3` |
|
|
572
|
+
| `STEEL` | `kg/m3` |
|
|
573
|
+
| `TITANIUM` | `kg/m3` |
|
|
574
|
+
| `WATER` | `kg/m3` |
|
|
575
|
+
| `WOOD` | `kg/m3` |
|
|
576
|
+
|
|
472
577
|
## Status
|
|
473
578
|
|
|
474
579
|
**BETA** - possibly breaking changes forthcoming
|
|
@@ -495,10 +600,11 @@ For Node.js REPL:
|
|
|
495
600
|
const units = await import("@thi.ng/units");
|
|
496
601
|
```
|
|
497
602
|
|
|
498
|
-
Package sizes (brotli'd, pre-treeshake): ESM:
|
|
603
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 4.37 KB
|
|
499
604
|
|
|
500
605
|
## Dependencies
|
|
501
606
|
|
|
607
|
+
- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/develop/packages/api)
|
|
502
608
|
- [@thi.ng/checks](https://github.com/thi-ng/umbrella/tree/develop/packages/checks)
|
|
503
609
|
- [@thi.ng/equiv](https://github.com/thi-ng/umbrella/tree/develop/packages/equiv)
|
|
504
610
|
- [@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,25 @@
|
|
|
1
|
+
export declare const AIR: import("../unit.js").Quantity<1.2>;
|
|
2
|
+
export declare const ALUMINIUM: import("../unit.js").Quantity<2700>;
|
|
3
|
+
export declare const ALUMINUM: import("../unit.js").Quantity<2700>;
|
|
4
|
+
export declare const CONCRETE: import("../unit.js").Quantity<2400>;
|
|
5
|
+
export declare const COPPER: import("../unit.js").Quantity<8940>;
|
|
6
|
+
export declare const DIAMOND: import("../unit.js").Quantity<3500>;
|
|
7
|
+
export declare const GLASS: import("../unit.js").Quantity<2500>;
|
|
8
|
+
export declare const GOLD: import("../unit.js").Quantity<19320>;
|
|
9
|
+
export declare const ICE: import("../unit.js").Quantity<916.7>;
|
|
10
|
+
export declare const IRON: import("../unit.js").Quantity<7870>;
|
|
11
|
+
export declare const NYLON: import("../unit.js").Quantity<1150>;
|
|
12
|
+
export declare const PLASTIC: import("../unit.js").Quantity<1175>;
|
|
13
|
+
export declare const PLATINUM: import("../unit.js").Quantity<21450>;
|
|
14
|
+
export declare const SAND: import("../unit.js").Quantity<1600>;
|
|
15
|
+
export declare const SALT_WATER: import("../unit.js").Quantity<1030>;
|
|
16
|
+
export declare const SILICON: import("../unit.js").Quantity<2330>;
|
|
17
|
+
export declare const SILVER: import("../unit.js").Quantity<10500>;
|
|
18
|
+
export declare const STEEL: import("../unit.js").Quantity<7850>;
|
|
19
|
+
export declare const TITANIUM: import("../unit.js").Quantity<4540>;
|
|
20
|
+
/**
|
|
21
|
+
* Fresh water @ 4 degree celsius (max. density)
|
|
22
|
+
*/
|
|
23
|
+
export declare const WATER: import("../unit.js").Quantity<1000>;
|
|
24
|
+
export declare const WOOD: import("../unit.js").Quantity<700>;
|
|
25
|
+
//# sourceMappingURL=densities.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { quantity } from "../unit.js";
|
|
2
|
+
import { kg_m3 } from "../units/density.js";
|
|
3
|
+
// https://en.wikipedia.org/wiki/Density#Various_materials
|
|
4
|
+
export const AIR = quantity(1.2, kg_m3);
|
|
5
|
+
export const ALUMINIUM = quantity(2700, kg_m3);
|
|
6
|
+
// for americans...
|
|
7
|
+
export const ALUMINUM = ALUMINIUM;
|
|
8
|
+
export const CONCRETE = quantity(2400, kg_m3);
|
|
9
|
+
export const COPPER = quantity(8940, kg_m3);
|
|
10
|
+
export const DIAMOND = quantity(3500, kg_m3);
|
|
11
|
+
export const GLASS = quantity(2500, kg_m3);
|
|
12
|
+
export const GOLD = quantity(19320, kg_m3);
|
|
13
|
+
export const ICE = quantity(916.7, kg_m3);
|
|
14
|
+
export const IRON = quantity(7870, kg_m3);
|
|
15
|
+
export const NYLON = quantity(1150, kg_m3);
|
|
16
|
+
export const PLASTIC = quantity(1175, kg_m3);
|
|
17
|
+
export const PLATINUM = quantity(21450, kg_m3);
|
|
18
|
+
export const SAND = quantity(1600, kg_m3);
|
|
19
|
+
export const SALT_WATER = quantity(1030, kg_m3);
|
|
20
|
+
export const SILICON = quantity(2330, kg_m3);
|
|
21
|
+
export const SILVER = quantity(10500, kg_m3);
|
|
22
|
+
export const STEEL = quantity(7850, kg_m3);
|
|
23
|
+
export const TITANIUM = quantity(4540, kg_m3);
|
|
24
|
+
/**
|
|
25
|
+
* Fresh water @ 4 degree celsius (max. density)
|
|
26
|
+
*/
|
|
27
|
+
export const WATER = quantity(1000, kg_m3);
|
|
28
|
+
export const WOOD = quantity(700, kg_m3);
|
|
@@ -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,12 @@
|
|
|
1
|
+
import { mm } from "../units/length.js";
|
|
2
|
+
import { quantity } from "../unit.js";
|
|
3
|
+
// https://en.wikipedia.org/wiki/ISO_216x
|
|
4
|
+
export const DIN_A0 = quantity([841, 1189], mm);
|
|
5
|
+
export const DIN_A1 = quantity([594, 841], mm);
|
|
6
|
+
export const DIN_A2 = quantity([420, 594], mm);
|
|
7
|
+
export const DIN_A3 = quantity([297, 420], mm);
|
|
8
|
+
export const DIN_A4 = quantity([210, 297], mm);
|
|
9
|
+
export const DIN_A5 = quantity([148, 210], mm);
|
|
10
|
+
export const DIN_A6 = quantity([105, 148], mm);
|
|
11
|
+
export const DIN_A7 = quantity([74, 105], mm);
|
|
12
|
+
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,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://en.wikipedia.org/wiki/Earth_radius
|
|
3
|
+
*/
|
|
4
|
+
export declare const EARTH_RADIUS: import("../unit.js").Quantity<6371000>;
|
|
5
|
+
/**
|
|
6
|
+
* At equator
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Reference:
|
|
10
|
+
* - https://en.wikipedia.org/wiki/Earth%27s_circumference
|
|
11
|
+
*/
|
|
12
|
+
export declare const EARTH_CIRCUMFERENCE: import("../unit.js").Quantity<40075017>;
|
|
13
|
+
/**
|
|
14
|
+
* Using equatorial mean as alternative to {@link g0}.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Reference:
|
|
18
|
+
* - https://en.wikipedia.org/wiki/Gravity_of_Earth
|
|
19
|
+
*/
|
|
20
|
+
export declare const EARTH_GRAVITY: import("../unit.js").Quantity<9.78033>;
|
|
21
|
+
/**
|
|
22
|
+
* https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html
|
|
23
|
+
*/
|
|
24
|
+
export declare const EARTH_MASS: import("../unit.js").Quantity<5.9722e+24>;
|
|
25
|
+
/**
|
|
26
|
+
* Gravitational constant (kg-1·m3·s-2)
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Reference:
|
|
30
|
+
* - https://en.wikipedia.org/wiki/Gravitational_constant
|
|
31
|
+
*/
|
|
32
|
+
export declare const GRAVITATION: import("../unit.js").Quantity<6.6743e-11>;
|
|
33
|
+
//# sourceMappingURL=earth.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { quantity, unit } from "../unit.js";
|
|
2
|
+
import { m_s2 } from "../units/accel.js";
|
|
3
|
+
import { m } from "../units/length.js";
|
|
4
|
+
/**
|
|
5
|
+
* https://en.wikipedia.org/wiki/Earth_radius
|
|
6
|
+
*/
|
|
7
|
+
export const EARTH_RADIUS = quantity(6371000, m);
|
|
8
|
+
/**
|
|
9
|
+
* At equator
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Reference:
|
|
13
|
+
* - https://en.wikipedia.org/wiki/Earth%27s_circumference
|
|
14
|
+
*/
|
|
15
|
+
export const EARTH_CIRCUMFERENCE = quantity(40075017, m);
|
|
16
|
+
/**
|
|
17
|
+
* Using equatorial mean as alternative to {@link g0}.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Reference:
|
|
21
|
+
* - https://en.wikipedia.org/wiki/Gravity_of_Earth
|
|
22
|
+
*/
|
|
23
|
+
export const EARTH_GRAVITY = quantity(9.78033, m_s2);
|
|
24
|
+
/**
|
|
25
|
+
* https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html
|
|
26
|
+
*/
|
|
27
|
+
export const EARTH_MASS = quantity(5.9722e24, "kg");
|
|
28
|
+
/**
|
|
29
|
+
* Gravitational constant (kg-1·m3·s-2)
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Reference:
|
|
33
|
+
* - https://en.wikipedia.org/wiki/Gravitational_constant
|
|
34
|
+
*/
|
|
35
|
+
export const GRAVITATION = quantity(6.6743e-11, unit([-1, 3, -2, 0, 0, 0, 0], 1));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://en.wikipedia.org/wiki/Speed_of_light
|
|
3
|
+
*/
|
|
4
|
+
export declare const SPEED_OF_LIGHT: import("../unit.js").Quantity<299792458>;
|
|
5
|
+
/**
|
|
6
|
+
* At 20 degree celsius
|
|
7
|
+
*/
|
|
8
|
+
export declare const SPEED_OF_SOUND_IN_AIR: import("../unit.js").Quantity<343.14>;
|
|
9
|
+
/**
|
|
10
|
+
* At 20 degree celsius
|
|
11
|
+
*/
|
|
12
|
+
export declare const SPEED_OF_SOUND_IN_WATER: import("../unit.js").Quantity<1482>;
|
|
13
|
+
//# sourceMappingURL=velocities.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { quantity } from "../unit.js";
|
|
2
|
+
import { m_s } from "../units/velocity.js";
|
|
3
|
+
/**
|
|
4
|
+
* https://en.wikipedia.org/wiki/Speed_of_light
|
|
5
|
+
*/
|
|
6
|
+
export const SPEED_OF_LIGHT = quantity(299792458, m_s);
|
|
7
|
+
/**
|
|
8
|
+
* At 20 degree celsius
|
|
9
|
+
*/
|
|
10
|
+
export const SPEED_OF_SOUND_IN_AIR = quantity(343.14, m_s);
|
|
11
|
+
/**
|
|
12
|
+
* At 20 degree celsius
|
|
13
|
+
*/
|
|
14
|
+
export const SPEED_OF_SOUND_IN_WATER = quantity(1482, m_s);
|
package/index.d.ts
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
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/densities.js";
|
|
24
|
+
export * from "./constants/din-sizes.js";
|
|
25
|
+
export * from "./constants/earth.js";
|
|
26
|
+
export * from "./constants/velocities.js";
|
|
22
27
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
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/densities.js";
|
|
24
|
+
export * from "./constants/din-sizes.js";
|
|
25
|
+
export * from "./constants/earth.js";
|
|
26
|
+
export * from "./constants/velocities.js";
|