@thi.ng/units 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/api.d.ts +101 -0
  3. package/package.json +10 -10
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  > [!NOTE]
10
10
 
11
- > This is one of 215 standalone projects. LLM-free, human-made and
11
+ > This is one of 216 standalone projects. LLM-free, human-made and
12
12
  > cared for software, maintained as part of the
13
13
  > [@thi.ng/umbrella](https://codeberg.org/thi.ng/umbrella/) ecosystem and
14
14
  > anti-framework.
package/api.d.ts ADDED
@@ -0,0 +1,101 @@
1
+ export interface Unit {
2
+ /**
3
+ * SI base dimension vector ({@link Dimensions})
4
+ */
5
+ dim: Dimensions;
6
+ /**
7
+ * Scaling factor relative to the coherent unit
8
+ */
9
+ scale: number;
10
+ /**
11
+ * Zero offset value
12
+ */
13
+ offset: number;
14
+ /**
15
+ * True, if this unit is coherent.
16
+ *
17
+ * @remarks
18
+ * Reference:
19
+ * - https://en.wikipedia.org/wiki/Coherence_(units_of_measurement)
20
+ */
21
+ coherent: boolean;
22
+ }
23
+ export interface NamedUnit extends Unit {
24
+ /**
25
+ * Symbol under which this unit can be looked up with via {@link asUnit} and
26
+ * others.
27
+ */
28
+ sym: string;
29
+ /**
30
+ * This unit's human readable description/name.
31
+ */
32
+ name: string;
33
+ }
34
+ export type MaybeUnit = Unit | string;
35
+ /**
36
+ * Vector of the 7 basic SI unit dimensions.
37
+ *
38
+ * @remarks
39
+ * In order:
40
+ *
41
+ * - 0 = mass
42
+ * - 1 = length
43
+ * - 2 = time
44
+ * - 3 = current
45
+ * - 4 = temperature
46
+ * - 5 = amount of substance
47
+ * - 6 = luminous intensity
48
+ *
49
+ * Note: For dimensionless units, all dimensions are zero.
50
+ *
51
+ * Reference:
52
+ * https://en.wikipedia.org/wiki/SI_base_unit
53
+ */
54
+ export type Dimensions = [
55
+ number,
56
+ number,
57
+ number,
58
+ number,
59
+ number,
60
+ number,
61
+ number
62
+ ];
63
+ /**
64
+ * A known metric prefix.
65
+ */
66
+ export type Prefix = keyof typeof PREFIXES;
67
+ /**
68
+ * @remarks
69
+ * Reference:
70
+ * https://en.wikipedia.org/wiki/Metric_prefix
71
+ */
72
+ export declare const PREFIXES: {
73
+ Q: number;
74
+ R: number;
75
+ Y: number;
76
+ Z: number;
77
+ E: number;
78
+ P: number;
79
+ T: number;
80
+ G: number;
81
+ M: number;
82
+ k: number;
83
+ h: number;
84
+ d: number;
85
+ c: number;
86
+ m: number;
87
+ µ: number;
88
+ n: number;
89
+ p: number;
90
+ f: number;
91
+ a: number;
92
+ z: number;
93
+ y: number;
94
+ r: number;
95
+ q: number;
96
+ };
97
+ /**
98
+ * Dimensionless unit preset.
99
+ */
100
+ export declare const NONE: Unit;
101
+ //# sourceMappingURL=api.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/units",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "Extensible SI unit creation, conversions, quantities & calculations, CLI calculator (incl. Lisp-like DSL and ~170 predefined units & constants)",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -41,14 +41,14 @@
41
41
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
42
42
  },
43
43
  "dependencies": {
44
- "@thi.ng/api": "^8.12.24",
45
- "@thi.ng/args": "^3.2.22",
46
- "@thi.ng/checks": "^3.9.4",
47
- "@thi.ng/compare": "^2.5.12",
48
- "@thi.ng/equiv": "^2.1.113",
49
- "@thi.ng/errors": "^2.6.13",
50
- "@thi.ng/sexpr": "^1.1.34",
51
- "@thi.ng/strings": "^3.12.6"
44
+ "@thi.ng/api": "^8.12.26",
45
+ "@thi.ng/args": "^3.2.24",
46
+ "@thi.ng/checks": "^3.10.0",
47
+ "@thi.ng/compare": "^2.5.14",
48
+ "@thi.ng/equiv": "^2.1.115",
49
+ "@thi.ng/errors": "^2.6.15",
50
+ "@thi.ng/sexpr": "^1.1.36",
51
+ "@thi.ng/strings": "^3.12.8"
52
52
  },
53
53
  "devDependencies": {
54
54
  "esbuild": "^0.28.0",
@@ -197,5 +197,5 @@
197
197
  "thi.ng": {
198
198
  "year": 2021
199
199
  },
200
- "gitHead": "b302822c51b2ab255f8f27f8dd010433d95f29df"
200
+ "gitHead": "c47c56420bcae2e0477d252a497be44f08ca185a"
201
201
  }