@utiliread/primitives 1.0.0-74 → 1.0.0-77
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/dist/cjs/index.js.map +1 -1
- package/dist/cjs/number-formatter.js +2 -4
- package/dist/cjs/number-formatter.js.map +1 -1
- package/dist/cjs/number-formatter.spec.js +461 -47
- package/dist/cjs/number-formatter.spec.js.map +1 -1
- package/dist/cjs/precision-number.js +8 -2
- package/dist/cjs/precision-number.js.map +1 -1
- package/dist/cjs/precision-number.spec.js +1 -1
- package/dist/cjs/precision-number.spec.js.map +1 -1
- package/dist/cjs/register-convention.js +4 -2
- package/dist/cjs/register-convention.js.map +1 -1
- package/dist/cjs/register-convention.spec.js +1 -1
- package/dist/cjs/register-convention.spec.js.map +1 -1
- package/dist/cjs/register-library.js +4 -2
- package/dist/cjs/register-library.js.map +1 -1
- package/dist/cjs/register-library.spec.js +3 -3
- package/dist/cjs/register-library.spec.js.map +1 -1
- package/dist/cjs/repository.js.map +1 -1
- package/dist/cjs/repository.spec.js +1 -1
- package/dist/cjs/repository.spec.js.map +1 -1
- package/dist/cjs/step.js +14 -10
- package/dist/cjs/step.js.map +1 -1
- package/dist/cjs/step.spec.js +2 -2
- package/dist/cjs/step.spec.js.map +1 -1
- package/dist/cjs/unit-id.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/number-formatter.js +2 -4
- package/dist/esm/number-formatter.js.map +1 -1
- package/dist/esm/number-formatter.spec.js +462 -48
- package/dist/esm/number-formatter.spec.js.map +1 -1
- package/dist/esm/precision-number.js +8 -2
- package/dist/esm/precision-number.js.map +1 -1
- package/dist/esm/precision-number.spec.js +1 -1
- package/dist/esm/precision-number.spec.js.map +1 -1
- package/dist/esm/register-convention.d.ts +1 -1
- package/dist/esm/register-convention.js +4 -2
- package/dist/esm/register-convention.js.map +1 -1
- package/dist/esm/register-convention.spec.js +1 -1
- package/dist/esm/register-convention.spec.js.map +1 -1
- package/dist/esm/register-definition.d.ts +1 -1
- package/dist/esm/register-library.js +4 -2
- package/dist/esm/register-library.js.map +1 -1
- package/dist/esm/register-library.spec.js +3 -3
- package/dist/esm/register-library.spec.js.map +1 -1
- package/dist/esm/repository.js.map +1 -1
- package/dist/esm/repository.spec.js +1 -1
- package/dist/esm/repository.spec.js.map +1 -1
- package/dist/esm/step.js +14 -10
- package/dist/esm/step.js.map +1 -1
- package/dist/esm/step.spec.js +2 -2
- package/dist/esm/step.spec.js.map +1 -1
- package/dist/esm/unit-id.js.map +1 -1
- package/locales/da/aggregates.json +7 -7
- package/locales/da/consumption-types.json +6 -6
- package/locales/da/measures.json +15 -15
- package/locales/da/registers.json +362 -221
- package/locales/da/units.json +92 -92
- package/locales/en/aggregates.json +7 -7
- package/locales/en/consumption-types.json +6 -6
- package/locales/en/measures.json +15 -15
- package/locales/en/registers.json +371 -221
- package/locales/en/units.json +92 -92
- package/package.json +7 -11
- package/src/aggregate-id.ts +8 -8
- package/src/consumption-type-id.ts +7 -7
- package/src/index.ts +39 -35
- package/src/measure-id.ts +14 -14
- package/src/number-formatter.spec.ts +509 -65
- package/src/number-formatter.ts +43 -20
- package/src/optional.ts +1 -1
- package/src/precision-number.spec.ts +28 -28
- package/src/precision-number.ts +44 -36
- package/src/register-convention.spec.ts +14 -5
- package/src/register-convention.ts +14 -5
- package/src/register-definition.ts +23 -23
- package/src/register-id.ts +266 -327
- package/src/register-library.spec.ts +5 -5
- package/src/register-library.ts +13 -7
- package/src/register-pack.ts +1 -1
- package/src/register-utils.ts +1 -1
- package/src/repository.spec.ts +20 -20
- package/src/repository.ts +24 -24
- package/src/step.spec.ts +13 -6
- package/src/step.ts +45 -37
- package/src/time-or-rule.ts +17 -17
- package/src/unit-id.ts +98 -119
- package/tsconfig.json +1 -0
- package/web-test-runner.config.mjs +7 -0
- package/karma.config.js +0 -32
package/src/register-library.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { RegisterId } from "./register-id";
|
|
|
3
3
|
import { RegisterPack } from "./register-pack";
|
|
4
4
|
|
|
5
5
|
class Library {
|
|
6
|
-
private definitions: Partial<{ [id in RegisterId]: RegisterDefinition }> =
|
|
6
|
+
private definitions: Partial<{ [id in RegisterId]: RegisterDefinition }> =
|
|
7
|
+
{};
|
|
7
8
|
public add(...definitions: (RegisterDefinition | RegisterPack)[]) {
|
|
8
9
|
for (const definition of definitions) {
|
|
9
10
|
if (isDefinition(definition)) {
|
|
10
11
|
this.tryAdd(definition);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
12
|
+
} else {
|
|
13
13
|
for (const definitionInPack of Object.values(definition)) {
|
|
14
14
|
this.tryAdd(definitionInPack);
|
|
15
15
|
}
|
|
@@ -42,7 +42,7 @@ class Library {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
public all() {
|
|
45
|
-
return Object.values(this.definitions).map(x => x!);
|
|
45
|
+
return Object.values(this.definitions).map((x) => x!);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
public reset() {
|
|
@@ -50,8 +50,14 @@ class Library {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
function isDefinition(
|
|
54
|
-
|
|
53
|
+
function isDefinition(
|
|
54
|
+
definitionOrPack: RegisterDefinition | RegisterPack,
|
|
55
|
+
): definitionOrPack is RegisterDefinition {
|
|
56
|
+
return !!(
|
|
57
|
+
definitionOrPack.id &&
|
|
58
|
+
definitionOrPack.aggregate &&
|
|
59
|
+
definitionOrPack.units
|
|
60
|
+
);
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
export const RegisterLibrary = new Library();
|
|
63
|
+
export const RegisterLibrary = new Library();
|
package/src/register-pack.ts
CHANGED
package/src/register-utils.ts
CHANGED
package/src/repository.spec.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
describe("ctor", () => {
|
|
5
|
-
it("creates", () => {
|
|
6
|
-
expect(Repository("gpkv", "gjoel")).to.equal("gpkv/gjoel");
|
|
7
|
-
expect(Repository("gpkv/gjoel")).to.equal("gpkv/gjoel");
|
|
8
|
-
});
|
|
9
|
-
it("throws if wrong format", () => {
|
|
10
|
-
expect(() => Repository("invalid")).to.throw();
|
|
11
|
-
})
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
describe("split", () => {
|
|
15
|
-
it("splits into correct parts", () => {
|
|
16
|
-
const { team, name } = Repository.split(Repository("gpkv", "gjoel"));
|
|
17
|
-
expect(team).to.equal("gpkv");
|
|
18
|
-
expect(name).to.equal("gjoel");
|
|
19
|
-
});
|
|
20
|
-
});
|
|
1
|
+
import { Repository } from "./repository";
|
|
2
|
+
import { expect } from "@esm-bundle/chai";
|
|
3
|
+
|
|
4
|
+
describe("ctor", () => {
|
|
5
|
+
it("creates", () => {
|
|
6
|
+
expect(Repository("gpkv", "gjoel")).to.equal("gpkv/gjoel");
|
|
7
|
+
expect(Repository("gpkv/gjoel")).to.equal("gpkv/gjoel");
|
|
8
|
+
});
|
|
9
|
+
it("throws if wrong format", () => {
|
|
10
|
+
expect(() => Repository("invalid")).to.throw();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe("split", () => {
|
|
15
|
+
it("splits into correct parts", () => {
|
|
16
|
+
const { team, name } = Repository.split(Repository("gpkv", "gjoel"));
|
|
17
|
+
expect(team).to.equal("gpkv");
|
|
18
|
+
expect(name).to.equal("gjoel");
|
|
19
|
+
});
|
|
20
|
+
});
|
package/src/repository.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
// This is clearly not correct but it provides some amazing type safety
|
|
2
|
-
export type Repository = "some/repo";
|
|
3
|
-
|
|
4
|
-
export function Repository(repo: string): Repository;
|
|
5
|
-
export function Repository(team: string, name: string): Repository;
|
|
6
|
-
export function Repository(repoOrTeam: string, name?: string): Repository {
|
|
7
|
-
if (name) {
|
|
8
|
-
return <Repository>`${repoOrTeam}/${name}`;
|
|
9
|
-
} else if (repoOrTeam.indexOf("/") > 0) {
|
|
10
|
-
return <Repository>repoOrTeam;
|
|
11
|
-
} else {
|
|
12
|
-
throw new TypeError("Invalid repository format");
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export namespace Repository {
|
|
17
|
-
export function split(repo: Repository) {
|
|
18
|
-
const parts = repo.split("/");
|
|
19
|
-
return {
|
|
20
|
-
team: parts[0],
|
|
21
|
-
name: parts[1],
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
// This is clearly not correct but it provides some amazing type safety
|
|
2
|
+
export type Repository = "some/repo";
|
|
3
|
+
|
|
4
|
+
export function Repository(repo: string): Repository;
|
|
5
|
+
export function Repository(team: string, name: string): Repository;
|
|
6
|
+
export function Repository(repoOrTeam: string, name?: string): Repository {
|
|
7
|
+
if (name) {
|
|
8
|
+
return <Repository>`${repoOrTeam}/${name}`;
|
|
9
|
+
} else if (repoOrTeam.indexOf("/") > 0) {
|
|
10
|
+
return <Repository>repoOrTeam;
|
|
11
|
+
} else {
|
|
12
|
+
throw new TypeError("Invalid repository format");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export namespace Repository {
|
|
17
|
+
export function split(repo: Repository) {
|
|
18
|
+
const parts = repo.split("/");
|
|
19
|
+
return {
|
|
20
|
+
team: parts[0],
|
|
21
|
+
name: parts[1],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/step.spec.ts
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { DateTime } from "luxon";
|
|
3
1
|
import { DayOfWeek, Step } from "./step";
|
|
4
2
|
|
|
3
|
+
import { DateTime } from "luxon";
|
|
4
|
+
import { expect } from "@esm-bundle/chai";
|
|
5
|
+
|
|
5
6
|
describe("startOf", () => {
|
|
6
7
|
it("returns start of day", () => {
|
|
7
8
|
const dt = DateTime.fromISO("2020-01-11T05:00:00+01:00");
|
|
8
9
|
const result = Step.startOf(dt, "day");
|
|
9
|
-
expect(+result).to.equal(
|
|
10
|
+
expect(+result).to.equal(
|
|
11
|
+
+DateTime.fromISO("2020-01-11T00:00:00+01:00"),
|
|
12
|
+
);
|
|
10
13
|
});
|
|
11
14
|
|
|
12
15
|
it("returns previous monday from saturday", () => {
|
|
13
16
|
const dt = DateTime.fromISO("2020-01-11T05:00:00+01:00");
|
|
14
17
|
const result = Step.startOf(dt, "week", DayOfWeek.Monday);
|
|
15
|
-
expect(+result).to.equal(
|
|
18
|
+
expect(+result).to.equal(
|
|
19
|
+
+DateTime.fromISO("2020-01-06T00:00:00+01:00"),
|
|
20
|
+
);
|
|
16
21
|
});
|
|
17
22
|
|
|
18
23
|
it("returns same monday from monday with hour", () => {
|
|
19
24
|
const dt = DateTime.fromISO("2020-01-13T05:00:00+01:00");
|
|
20
25
|
const result = Step.startOf(dt, "week", DayOfWeek.Monday);
|
|
21
|
-
expect(+result).to.equal(
|
|
26
|
+
expect(+result).to.equal(
|
|
27
|
+
+DateTime.fromISO("2020-01-13T00:00:00+01:00"),
|
|
28
|
+
);
|
|
22
29
|
});
|
|
23
30
|
});
|
|
24
31
|
|
|
@@ -27,4 +34,4 @@ describe("asDuration", () => {
|
|
|
27
34
|
const duration = Step.asDuration("week");
|
|
28
35
|
expect(duration.days).to.equal(7);
|
|
29
36
|
});
|
|
30
|
-
});
|
|
37
|
+
});
|
package/src/step.ts
CHANGED
|
@@ -1,37 +1,45 @@
|
|
|
1
|
-
import { DateTime, Duration } from "luxon";
|
|
2
|
-
|
|
3
|
-
export type Step = "hour" | "day" | "week" | "month" | "year";
|
|
4
|
-
|
|
5
|
-
export enum DayOfWeek {
|
|
6
|
-
Monday = 1,
|
|
7
|
-
Tuesday = 2,
|
|
8
|
-
Wednesday = 3,
|
|
9
|
-
Thursday = 4,
|
|
10
|
-
Friday = 5,
|
|
11
|
-
Saturday = 6,
|
|
12
|
-
Sunday = 7,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export namespace Step {
|
|
16
|
-
export function startOf(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
case "
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { DateTime, Duration } from "luxon";
|
|
2
|
+
|
|
3
|
+
export type Step = "hour" | "day" | "week" | "month" | "year";
|
|
4
|
+
|
|
5
|
+
export enum DayOfWeek {
|
|
6
|
+
Monday = 1,
|
|
7
|
+
Tuesday = 2,
|
|
8
|
+
Wednesday = 3,
|
|
9
|
+
Thursday = 4,
|
|
10
|
+
Friday = 5,
|
|
11
|
+
Saturday = 6,
|
|
12
|
+
Sunday = 7,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export namespace Step {
|
|
16
|
+
export function startOf(
|
|
17
|
+
dateTime: DateTime,
|
|
18
|
+
step: Step,
|
|
19
|
+
firstDayOfWeek?: DayOfWeek,
|
|
20
|
+
): DateTime {
|
|
21
|
+
if (step === "week") {
|
|
22
|
+
const value = dateTime
|
|
23
|
+
.startOf("day")
|
|
24
|
+
.set({ weekday: firstDayOfWeek ?? DayOfWeek.Monday });
|
|
25
|
+
return value > dateTime ? value.minus({ days: 7 }) : value;
|
|
26
|
+
} else {
|
|
27
|
+
return dateTime.startOf(step);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function asDuration(step: Step, amount = 1): Duration {
|
|
32
|
+
switch (step) {
|
|
33
|
+
case "hour":
|
|
34
|
+
return Duration.fromObject({ hours: amount });
|
|
35
|
+
case "day":
|
|
36
|
+
return Duration.fromObject({ days: amount });
|
|
37
|
+
case "week":
|
|
38
|
+
return Duration.fromObject({ days: 7 * amount });
|
|
39
|
+
case "month":
|
|
40
|
+
return Duration.fromObject({ months: amount });
|
|
41
|
+
case "year":
|
|
42
|
+
return Duration.fromObject({ years: amount });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/time-or-rule.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { DateTime } from "luxon";
|
|
2
|
-
|
|
3
|
-
export type TimeOrRule = Date | DateTime | string;
|
|
4
|
-
|
|
5
|
-
export namespace TimeOrRule {
|
|
6
|
-
export function isTime(input: TimeOrRule): input is Date | DateTime {
|
|
7
|
-
return typeof input !== "string";
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function isRule(input: TimeOrRule): input is string {
|
|
11
|
-
return typeof input === "string";
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function asJSON(input: TimeOrRule) {
|
|
15
|
-
return isRule(input) ? input : input.toJSON();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
|
+
|
|
3
|
+
export type TimeOrRule = Date | DateTime | string;
|
|
4
|
+
|
|
5
|
+
export namespace TimeOrRule {
|
|
6
|
+
export function isTime(input: TimeOrRule): input is Date | DateTime {
|
|
7
|
+
return typeof input !== "string";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function isRule(input: TimeOrRule): input is string {
|
|
11
|
+
return typeof input === "string";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function asJSON(input: TimeOrRule) {
|
|
15
|
+
return isRule(input) ? input : input.toJSON();
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/unit-id.ts
CHANGED
|
@@ -1,123 +1,102 @@
|
|
|
1
1
|
export type UnitId =
|
|
2
|
-
"unitless"
|
|
3
|
-
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
"celcius" |
|
|
101
|
-
"kelvin" |
|
|
102
|
-
"fahrenheit" |
|
|
103
|
-
|
|
104
|
-
"bar" |
|
|
105
|
-
"bar2" |
|
|
106
|
-
"pascal" |
|
|
107
|
-
"pascal2" |
|
|
108
|
-
|
|
109
|
-
"var" |
|
|
110
|
-
"kiloVar" |
|
|
111
|
-
"megaVar" |
|
|
112
|
-
|
|
113
|
-
"varHour" |
|
|
114
|
-
"kiloVarHour" |
|
|
115
|
-
"megaVarHour" |
|
|
116
|
-
|
|
117
|
-
"percentage" |
|
|
118
|
-
|
|
119
|
-
"literCelcius" |
|
|
120
|
-
"cubicMeterCelcius";
|
|
2
|
+
| "unitless"
|
|
3
|
+
| "milliWattHour"
|
|
4
|
+
| "wattHour"
|
|
5
|
+
| "kiloWattHour"
|
|
6
|
+
| "megaWattHour"
|
|
7
|
+
| "gigaWattHour"
|
|
8
|
+
| "calorie"
|
|
9
|
+
| "kiloCalorie"
|
|
10
|
+
| "megaCalorie"
|
|
11
|
+
| "joule"
|
|
12
|
+
| "kiloJoule"
|
|
13
|
+
| "megaJoule"
|
|
14
|
+
| "gigaJoule"
|
|
15
|
+
| "liter"
|
|
16
|
+
| "cubicMeter"
|
|
17
|
+
| "fluidOunce"
|
|
18
|
+
| "gallon"
|
|
19
|
+
| "gram"
|
|
20
|
+
| "kiloGram"
|
|
21
|
+
| "tonne"
|
|
22
|
+
| "ounce"
|
|
23
|
+
| "pound"
|
|
24
|
+
| "ton"
|
|
25
|
+
| "second"
|
|
26
|
+
| "minute"
|
|
27
|
+
| "hour"
|
|
28
|
+
| "day"
|
|
29
|
+
| "week"
|
|
30
|
+
| "month"
|
|
31
|
+
| "year"
|
|
32
|
+
| "milliWatt"
|
|
33
|
+
| "milliWatt2"
|
|
34
|
+
| "watt"
|
|
35
|
+
| "watt2"
|
|
36
|
+
| "kiloWatt"
|
|
37
|
+
| "kiloWatt2"
|
|
38
|
+
| "megaWatt"
|
|
39
|
+
| "megaWatt2"
|
|
40
|
+
| "gigaWatt"
|
|
41
|
+
| "gigaWatt2"
|
|
42
|
+
| "joulesPerSecond"
|
|
43
|
+
| "joulesPerSecond2"
|
|
44
|
+
| "joulesPerMinute"
|
|
45
|
+
| "joulesPerMinute2"
|
|
46
|
+
| "joulesPerHour"
|
|
47
|
+
| "joulesPerHour2"
|
|
48
|
+
| "litersPerSecond"
|
|
49
|
+
| "litersPerSecond2"
|
|
50
|
+
| "litersPerMinute"
|
|
51
|
+
| "litersPerMinute2"
|
|
52
|
+
| "litersPerHour"
|
|
53
|
+
| "litersPerHour2"
|
|
54
|
+
| "cubicMetersPerSecond"
|
|
55
|
+
| "cubicMetersPerSecond2"
|
|
56
|
+
| "cubicMetersPerMinute"
|
|
57
|
+
| "cubicMetersPerMinute2"
|
|
58
|
+
| "cubicMetersPerHour"
|
|
59
|
+
| "cubicMetersPerHour2"
|
|
60
|
+
| "fluidOuncesPerSecond"
|
|
61
|
+
| "fluidOuncesPerSecond2"
|
|
62
|
+
| "fluidOuncesPerMinute"
|
|
63
|
+
| "fluidOuncesPerMinute2"
|
|
64
|
+
| "fluidOuncesPerHour"
|
|
65
|
+
| "fluidOuncesPerHour2"
|
|
66
|
+
| "gallonsPerSecond"
|
|
67
|
+
| "gallonsPerSecond2"
|
|
68
|
+
| "gallonsPerMinute"
|
|
69
|
+
| "gallonsPerMinute2"
|
|
70
|
+
| "gallonsPerHour"
|
|
71
|
+
| "gallonsPerHour2"
|
|
72
|
+
| "gramsPerSecond"
|
|
73
|
+
| "gramsPerSecond2"
|
|
74
|
+
| "gramsPerMinute"
|
|
75
|
+
| "gramsPerMinute2"
|
|
76
|
+
| "gramsPerHour"
|
|
77
|
+
| "gramsPerHour2"
|
|
78
|
+
| "kiloGramsPerSecond"
|
|
79
|
+
| "kiloGramsPerSecond2"
|
|
80
|
+
| "kiloGramsPerMinute"
|
|
81
|
+
| "kiloGramsPerMinute2"
|
|
82
|
+
| "kiloGramsPerHour"
|
|
83
|
+
| "kiloGramsPerHour2"
|
|
84
|
+
| "celcius"
|
|
85
|
+
| "kelvin"
|
|
86
|
+
| "fahrenheit"
|
|
87
|
+
| "bar"
|
|
88
|
+
| "bar2"
|
|
89
|
+
| "pascal"
|
|
90
|
+
| "pascal2"
|
|
91
|
+
| "var"
|
|
92
|
+
| "kiloVar"
|
|
93
|
+
| "megaVar"
|
|
94
|
+
| "varHour"
|
|
95
|
+
| "kiloVarHour"
|
|
96
|
+
| "megaVarHour"
|
|
97
|
+
| "percentage"
|
|
98
|
+
| "literCelcius"
|
|
99
|
+
| "cubicMeterCelcius";
|
|
121
100
|
|
|
122
101
|
export const energyUnits: UnitId[] = [
|
|
123
102
|
"milliWattHour",
|
package/tsconfig.json
CHANGED
package/karma.config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const tsconfig = require("./tsconfig.json");
|
|
2
|
-
|
|
3
|
-
module.exports = function (config) {
|
|
4
|
-
config.set({
|
|
5
|
-
frameworks: ["mocha", "chai", "karma-typescript"],
|
|
6
|
-
files: ["src/**/*.ts"],
|
|
7
|
-
preprocessors: {
|
|
8
|
-
"src/**/*.ts": ["karma-typescript"],
|
|
9
|
-
},
|
|
10
|
-
reporters: ["progress", "karma-typescript"],
|
|
11
|
-
browsers: ["ChromeHeadless", "ChromeDebugging", "Chrome"],
|
|
12
|
-
customLaunchers: {
|
|
13
|
-
ChromeDebugging: {
|
|
14
|
-
base: "Chrome",
|
|
15
|
-
flags: ["--remote-debugging-port=9222"],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
karmaTypescriptConfig: {
|
|
19
|
-
bundlerOptions: {
|
|
20
|
-
entrypoints: /\.spec\.ts$/,
|
|
21
|
-
sourceMap: tsconfig.compilerOptions.sourceMap,
|
|
22
|
-
acornOptions: {
|
|
23
|
-
ecmaVersion: "latest",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
coverageOptions: {
|
|
27
|
-
instrumentation: false,
|
|
28
|
-
},
|
|
29
|
-
tsconfig: "./tsconfig.cjs.json",
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
};
|