@thi.ng/units 1.4.1 โ†’ 1.4.4

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 +5 -3
  2. package/api.d.ts +101 -0
  3. package/package.json +11 -10
package/README.md CHANGED
@@ -7,9 +7,11 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 215 standalone projects, maintained as part
11
- > of the [@thi.ng/umbrella](https://codeberg.org/thi.ng/umbrella/) ecosystem
12
- > and anti-framework.
10
+
11
+ > This is one of 215 standalone projects. LLM-free, human-made and
12
+ > cared for software, maintained as part of the
13
+ > [@thi.ng/umbrella](https://codeberg.org/thi.ng/umbrella/) ecosystem and
14
+ > anti-framework.
13
15
  >
14
16
  > ๐Ÿš€ Please help me to work full-time on these projects by [sponsoring
15
17
  > me](https://codeberg.org/thi.ng/umbrella/src/branch/develop/CONTRIBUTING.md#donations).
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.1",
3
+ "version": "1.4.4",
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.22",
45
- "@thi.ng/args": "^3.2.20",
46
- "@thi.ng/checks": "^3.9.2",
47
- "@thi.ng/compare": "^2.5.10",
48
- "@thi.ng/equiv": "^2.1.111",
49
- "@thi.ng/errors": "^2.6.11",
50
- "@thi.ng/sexpr": "^1.1.32",
51
- "@thi.ng/strings": "^3.12.4"
44
+ "@thi.ng/api": "^8.12.25",
45
+ "@thi.ng/args": "^3.2.23",
46
+ "@thi.ng/checks": "^3.9.5",
47
+ "@thi.ng/compare": "^2.5.13",
48
+ "@thi.ng/equiv": "^2.1.114",
49
+ "@thi.ng/errors": "^2.6.14",
50
+ "@thi.ng/sexpr": "^1.1.35",
51
+ "@thi.ng/strings": "^3.12.7"
52
52
  },
53
53
  "devDependencies": {
54
54
  "esbuild": "^0.28.0",
@@ -101,6 +101,7 @@
101
101
  "files": [
102
102
  "./*.js",
103
103
  "./*.d.ts",
104
+ "bin",
104
105
  "constants",
105
106
  "units"
106
107
  ],
@@ -196,5 +197,5 @@
196
197
  "thi.ng": {
197
198
  "year": 2021
198
199
  },
199
- "gitHead": "5a07827c49031f14b2b768c6592257c2299f7811"
200
+ "gitHead": "65b041e97110e16c01cf968949b72a0873f14445"
200
201
  }