measurable 1.1.1 → 3.0.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 +149 -0
- package/README.md +271 -53
- package/dist/dimensions/angle.js +13 -6
- package/dist/dimensions/area.d.ts +14 -0
- package/dist/dimensions/area.js +46 -0
- package/dist/dimensions/data.d.ts +10 -0
- package/dist/dimensions/data.js +39 -0
- package/dist/dimensions/energy.d.ts +14 -0
- package/dist/dimensions/energy.js +29 -0
- package/dist/dimensions/force.js +6 -6
- package/dist/dimensions/frequency.d.ts +7 -0
- package/dist/dimensions/frequency.js +11 -0
- package/dist/dimensions/illuminance.d.ts +9 -0
- package/dist/dimensions/illuminance.js +16 -0
- package/dist/dimensions/index.d.ts +9 -0
- package/dist/dimensions/index.js +9 -0
- package/dist/dimensions/length.js +7 -7
- package/dist/dimensions/luminance.d.ts +7 -0
- package/dist/dimensions/luminance.js +13 -0
- package/dist/dimensions/luminousIntensity.d.ts +9 -0
- package/dist/dimensions/luminousIntensity.js +16 -0
- package/dist/dimensions/mass.js +13 -9
- package/dist/dimensions/power.d.ts +9 -0
- package/dist/dimensions/power.js +13 -0
- package/dist/dimensions/pressure.d.ts +14 -0
- package/dist/dimensions/pressure.js +21 -0
- package/dist/dimensions/temperature.js +9 -3
- package/dist/dimensions/time.js +19 -7
- package/dist/dimensions/volume.js +57 -24
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/lib/Dimension.d.ts +49 -14
- package/dist/lib/Dimension.js +58 -21
- package/dist/lib/MeasurementSystem.js +2 -2
- package/dist/lib/Quantity.d.ts +94 -10
- package/dist/lib/Quantity.js +92 -37
- package/dist/lib/Rational.d.ts +58 -0
- package/dist/lib/Rational.js +174 -0
- package/dist/lib/Unit.d.ts +52 -11
- package/dist/lib/Unit.js +41 -8
- package/dist/lib/prefixes.d.ts +2 -2
- package/dist/lib/prefixes.js +1 -1
- package/dist/systems/imperial.js +19 -1
- package/dist/systems/metric.js +25 -1
- package/dist/systems/usCustomary.js +19 -1
- package/dist/utils/definePrefixed.d.ts +28 -0
- package/dist/utils/definePrefixed.js +72 -0
- package/dist/utils/scaleOf.d.ts +3 -0
- package/dist/utils/scaleOf.js +6 -0
- package/package.json +13 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Dimension } from "../lib/Dimension";
|
|
2
|
+
/** Area. Base unit: square meter. */
|
|
3
|
+
export declare const area: Dimension;
|
|
4
|
+
export declare const squareMeter: import("..").Unit;
|
|
5
|
+
export declare const squareKilometer: import("..").Unit;
|
|
6
|
+
export declare const hectare: import("..").Unit;
|
|
7
|
+
export declare const are: import("..").Unit;
|
|
8
|
+
export declare const squareCentimeter: import("..").Unit;
|
|
9
|
+
export declare const squareMillimeter: import("..").Unit;
|
|
10
|
+
export declare const squareInch: import("..").Unit;
|
|
11
|
+
export declare const squareFoot: import("..").Unit;
|
|
12
|
+
export declare const squareYard: import("..").Unit;
|
|
13
|
+
export declare const acre: import("..").Unit;
|
|
14
|
+
export declare const squareMile: import("..").Unit;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.squareMile = exports.acre = exports.squareYard = exports.squareFoot = exports.squareInch = exports.squareMillimeter = exports.squareCentimeter = exports.are = exports.hectare = exports.squareKilometer = exports.squareMeter = exports.area = void 0;
|
|
4
|
+
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
+
/** Area. Base unit: square meter. */
|
|
6
|
+
exports.area = new Dimension_1.Dimension("area");
|
|
7
|
+
exports.squareMeter = exports.area.base("squareMeter", {
|
|
8
|
+
symbol: "m²",
|
|
9
|
+
plural: "square meters",
|
|
10
|
+
aliases: ["m2", "square meter"],
|
|
11
|
+
});
|
|
12
|
+
// Metric multiples/submultiples. Area scales as the square of the length
|
|
13
|
+
// prefix, so these can't be generated by the linear SI prefix helper.
|
|
14
|
+
exports.squareKilometer = exports.area.unit("squareKilometer", 1e6, {
|
|
15
|
+
symbol: "km²",
|
|
16
|
+
aliases: ["km2"],
|
|
17
|
+
});
|
|
18
|
+
exports.hectare = exports.area.unit("hectare", 1e4, { symbol: "ha", plural: "hectares" });
|
|
19
|
+
exports.are = exports.area.unit("are", 1e2, { plural: "ares" });
|
|
20
|
+
exports.squareCentimeter = exports.area.unit("squareCentimeter", 1e-4, {
|
|
21
|
+
symbol: "cm²",
|
|
22
|
+
aliases: ["cm2"],
|
|
23
|
+
});
|
|
24
|
+
exports.squareMillimeter = exports.area.unit("squareMillimeter", 1e-6, {
|
|
25
|
+
symbol: "mm²",
|
|
26
|
+
aliases: ["mm2"],
|
|
27
|
+
});
|
|
28
|
+
// Imperial / US customary.
|
|
29
|
+
exports.squareInch = exports.area.unit("squareInch", 6.4516e-4, {
|
|
30
|
+
symbol: "in²",
|
|
31
|
+
aliases: ["sq in", "in2"],
|
|
32
|
+
});
|
|
33
|
+
exports.squareFoot = exports.area.unit("squareFoot", 9.290304e-2, {
|
|
34
|
+
symbol: "ft²",
|
|
35
|
+
plural: "square feet",
|
|
36
|
+
aliases: ["sq ft", "ft2"],
|
|
37
|
+
});
|
|
38
|
+
exports.squareYard = exports.area.unit("squareYard", 0.83612736, {
|
|
39
|
+
symbol: "yd²",
|
|
40
|
+
aliases: ["sq yd", "yd2"],
|
|
41
|
+
});
|
|
42
|
+
exports.acre = exports.area.unit("acre", 4046.8564224, { symbol: "ac", plural: "acres" });
|
|
43
|
+
exports.squareMile = exports.area.unit("squareMile", 2589988.110336, {
|
|
44
|
+
symbol: "mi²",
|
|
45
|
+
aliases: ["sq mi", "mi2"],
|
|
46
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dimension } from "../lib/Dimension";
|
|
2
|
+
import type { Unit } from "../lib/Unit";
|
|
3
|
+
/** Digital information. Base unit: bit. */
|
|
4
|
+
export declare const data: Dimension;
|
|
5
|
+
export declare const bit: Unit;
|
|
6
|
+
export declare const nibble: Unit;
|
|
7
|
+
export declare const byte: Unit;
|
|
8
|
+
/** Every SI and IEC multiple of the bit and byte, keyed by name. */
|
|
9
|
+
export declare const dataMultiples: Record<string, Unit>;
|
|
10
|
+
export declare const kilobit: Unit, kilobyte: Unit, megabit: Unit, megabyte: Unit, gigabit: Unit, gigabyte: Unit, terabit: Unit, terabyte: Unit, petabit: Unit, petabyte: Unit, kibibit: Unit, kibibyte: Unit, mebibit: Unit, mebibyte: Unit, gibibit: Unit, gibibyte: Unit, tebibit: Unit, tebibyte: Unit, pebibit: Unit, pebibyte: Unit;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pebibyte = exports.pebibit = exports.tebibyte = exports.tebibit = exports.gibibyte = exports.gibibit = exports.mebibyte = exports.mebibit = exports.kibibyte = exports.kibibit = exports.petabyte = exports.petabit = exports.terabyte = exports.terabit = exports.gigabyte = exports.gigabit = exports.megabyte = exports.megabit = exports.kilobyte = exports.kilobit = exports.dataMultiples = exports.byte = exports.nibble = exports.bit = exports.data = void 0;
|
|
4
|
+
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
+
/** Digital information. Base unit: bit. */
|
|
6
|
+
exports.data = new Dimension_1.Dimension("data");
|
|
7
|
+
exports.bit = exports.data.base("bit", { symbol: "b", plural: "bits" });
|
|
8
|
+
exports.nibble = exports.data.unit("nibble", 4, { plural: "nibbles" });
|
|
9
|
+
exports.byte = exports.data.unit("byte", 8, { symbol: "B", plural: "bytes" });
|
|
10
|
+
// SI (decimal, 1000-based) and IEC (binary, 1024-based) multiples of the bit
|
|
11
|
+
// and byte. SI uses the bare symbol (kb, kB); IEC uses the "i" infix (Kib, KiB).
|
|
12
|
+
const SI_MULTIPLES = [
|
|
13
|
+
["kilo", "k", 1e3],
|
|
14
|
+
["mega", "M", 1e6],
|
|
15
|
+
["giga", "G", 1e9],
|
|
16
|
+
["tera", "T", 1e12],
|
|
17
|
+
["peta", "P", 1e15],
|
|
18
|
+
];
|
|
19
|
+
const IEC_MULTIPLES = [
|
|
20
|
+
["kibi", "Ki", 2 ** 10],
|
|
21
|
+
["mebi", "Mi", 2 ** 20],
|
|
22
|
+
["gibi", "Gi", 2 ** 30],
|
|
23
|
+
["tebi", "Ti", 2 ** 40],
|
|
24
|
+
["pebi", "Pi", 2 ** 50],
|
|
25
|
+
];
|
|
26
|
+
const multiples = {};
|
|
27
|
+
for (const [prefix, symbol, factor] of [...SI_MULTIPLES, ...IEC_MULTIPLES]) {
|
|
28
|
+
multiples[`${prefix}bit`] = exports.data.unit(`${prefix}bit`, factor, {
|
|
29
|
+
symbol: `${symbol}b`,
|
|
30
|
+
plural: `${prefix}bits`,
|
|
31
|
+
});
|
|
32
|
+
multiples[`${prefix}byte`] = exports.data.unit(`${prefix}byte`, 8 * factor, {
|
|
33
|
+
symbol: `${symbol}B`,
|
|
34
|
+
plural: `${prefix}bytes`,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** Every SI and IEC multiple of the bit and byte, keyed by name. */
|
|
38
|
+
exports.dataMultiples = multiples;
|
|
39
|
+
exports.kilobit = multiples.kilobit, exports.kilobyte = multiples.kilobyte, exports.megabit = multiples.megabit, exports.megabyte = multiples.megabyte, exports.gigabit = multiples.gigabit, exports.gigabyte = multiples.gigabyte, exports.terabit = multiples.terabit, exports.terabyte = multiples.terabyte, exports.petabit = multiples.petabit, exports.petabyte = multiples.petabyte, exports.kibibit = multiples.kibibit, exports.kibibyte = multiples.kibibyte, exports.mebibit = multiples.mebibit, exports.mebibyte = multiples.mebibyte, exports.gibibit = multiples.gibibit, exports.gibibyte = multiples.gibibyte, exports.tebibit = multiples.tebibit, exports.tebibyte = multiples.tebibyte, exports.pebibit = multiples.pebibit, exports.pebibyte = multiples.pebibyte;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Dimension } from "../lib/Dimension";
|
|
2
|
+
/** Energy. Base unit: joule. */
|
|
3
|
+
export declare const energy: Dimension;
|
|
4
|
+
export declare const joule: import("..").Unit;
|
|
5
|
+
export declare const calorie: import("..").Unit;
|
|
6
|
+
export declare const kilocalorie: import("..").Unit;
|
|
7
|
+
export declare const britishThermalUnit: import("..").Unit;
|
|
8
|
+
export declare const wattHour: import("..").Unit;
|
|
9
|
+
/** Every SI-prefixed joule (kilojoule, megajoule, millijoule, …), keyed by name. */
|
|
10
|
+
export declare const metricEnergy: Record<string, import("..").Unit>;
|
|
11
|
+
export declare const kilojoule: import("..").Unit, megajoule: import("..").Unit, gigajoule: import("..").Unit, millijoule: import("..").Unit;
|
|
12
|
+
/** Every SI-prefixed watt-hour (kilowatt-hour, megawatt-hour, …), keyed by name. */
|
|
13
|
+
export declare const metricWattHour: Record<string, import("..").Unit>;
|
|
14
|
+
export declare const kilowattHour: import("..").Unit, megawattHour: import("..").Unit, gigawattHour: import("..").Unit;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gigawattHour = exports.megawattHour = exports.kilowattHour = exports.metricWattHour = exports.millijoule = exports.gigajoule = exports.megajoule = exports.kilojoule = exports.metricEnergy = exports.wattHour = exports.britishThermalUnit = exports.kilocalorie = exports.calorie = exports.joule = exports.energy = void 0;
|
|
4
|
+
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
|
+
/** Energy. Base unit: joule. */
|
|
7
|
+
exports.energy = new Dimension_1.Dimension("energy");
|
|
8
|
+
exports.joule = exports.energy.base("joule", { symbol: "J", plural: "joules" });
|
|
9
|
+
exports.calorie = exports.energy.unit("calorie", 4.184, { symbol: "cal", plural: "calories" });
|
|
10
|
+
exports.kilocalorie = exports.energy.unit("kilocalorie", 4184, {
|
|
11
|
+
symbol: "kcal",
|
|
12
|
+
plural: "kilocalories",
|
|
13
|
+
aliases: ["Cal"],
|
|
14
|
+
});
|
|
15
|
+
exports.britishThermalUnit = exports.energy.unit("britishThermalUnit", 1055.05585262, {
|
|
16
|
+
symbol: "BTU",
|
|
17
|
+
aliases: ["Btu"],
|
|
18
|
+
});
|
|
19
|
+
exports.wattHour = exports.energy.unit("wattHour", 3600, {
|
|
20
|
+
symbol: "Wh",
|
|
21
|
+
plural: "watt-hours",
|
|
22
|
+
aliases: ["watt-hour"],
|
|
23
|
+
});
|
|
24
|
+
/** Every SI-prefixed joule (kilojoule, megajoule, millijoule, …), keyed by name. */
|
|
25
|
+
exports.metricEnergy = (0, definePrefixed_1.definePrefixed)(exports.energy, exports.joule);
|
|
26
|
+
exports.kilojoule = exports.metricEnergy.kilojoule, exports.megajoule = exports.metricEnergy.megajoule, exports.gigajoule = exports.metricEnergy.gigajoule, exports.millijoule = exports.metricEnergy.millijoule;
|
|
27
|
+
/** Every SI-prefixed watt-hour (kilowatt-hour, megawatt-hour, …), keyed by name. */
|
|
28
|
+
exports.metricWattHour = (0, definePrefixed_1.definePrefixed)(exports.energy, exports.wattHour);
|
|
29
|
+
exports.kilowattHour = exports.metricWattHour.kilowattHour, exports.megawattHour = exports.metricWattHour.megawattHour, exports.gigawattHour = exports.metricWattHour.gigawattHour;
|
package/dist/dimensions/force.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.micronewton = exports.millinewton = exports.kilonewton = exports.meganewton = exports.metricForce = exports.kilogramForce = exports.poundForce = exports.dyne = exports.newton = exports.force = void 0;
|
|
4
4
|
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
-
const
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
6
|
/** Force. Base unit: newton. */
|
|
7
7
|
exports.force = new Dimension_1.Dimension("force");
|
|
8
|
-
exports.newton = exports.force.base("newton",
|
|
9
|
-
exports.dyne = exports.force.unit("dyne", 0.00001,
|
|
10
|
-
exports.poundForce = exports.force.unit("poundForce", 4.4482216152605,
|
|
11
|
-
exports.kilogramForce = exports.force.unit("kilogramForce", 9.80665,
|
|
8
|
+
exports.newton = exports.force.base("newton", { symbol: "N", plural: "newtons" });
|
|
9
|
+
exports.dyne = exports.force.unit("dyne", 0.00001, { symbol: "dyn", plural: "dynes" });
|
|
10
|
+
exports.poundForce = exports.force.unit("poundForce", 4.4482216152605, { symbol: "lbf" });
|
|
11
|
+
exports.kilogramForce = exports.force.unit("kilogramForce", 9.80665, { symbol: "kgf" });
|
|
12
12
|
/** Every SI-prefixed newton (kilonewton, meganewton, millinewton, …), keyed by name. */
|
|
13
|
-
exports.metricForce = (0,
|
|
13
|
+
exports.metricForce = (0, definePrefixed_1.definePrefixed)(exports.force, exports.newton);
|
|
14
14
|
exports.meganewton = exports.metricForce.meganewton, exports.kilonewton = exports.metricForce.kilonewton, exports.millinewton = exports.metricForce.millinewton, exports.micronewton = exports.metricForce.micronewton;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Dimension } from "../lib/Dimension";
|
|
2
|
+
/** Frequency. Base unit: hertz. */
|
|
3
|
+
export declare const frequency: Dimension;
|
|
4
|
+
export declare const hertz: import("..").Unit;
|
|
5
|
+
/** Every SI-prefixed hertz (kilohertz, megahertz, gigahertz, …), keyed by name. */
|
|
6
|
+
export declare const metricFrequency: Record<string, import("..").Unit>;
|
|
7
|
+
export declare const kilohertz: import("..").Unit, megahertz: import("..").Unit, gigahertz: import("..").Unit, terahertz: import("..").Unit, petahertz: import("..").Unit, millihertz: import("..").Unit;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.millihertz = exports.petahertz = exports.terahertz = exports.gigahertz = exports.megahertz = exports.kilohertz = exports.metricFrequency = exports.hertz = exports.frequency = void 0;
|
|
4
|
+
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
|
+
/** Frequency. Base unit: hertz. */
|
|
7
|
+
exports.frequency = new Dimension_1.Dimension("frequency");
|
|
8
|
+
exports.hertz = exports.frequency.base("hertz", { symbol: "Hz" });
|
|
9
|
+
/** Every SI-prefixed hertz (kilohertz, megahertz, gigahertz, …), keyed by name. */
|
|
10
|
+
exports.metricFrequency = (0, definePrefixed_1.definePrefixed)(exports.frequency, exports.hertz);
|
|
11
|
+
exports.kilohertz = exports.metricFrequency.kilohertz, exports.megahertz = exports.metricFrequency.megahertz, exports.gigahertz = exports.metricFrequency.gigahertz, exports.terahertz = exports.metricFrequency.terahertz, exports.petahertz = exports.metricFrequency.petahertz, exports.millihertz = exports.metricFrequency.millihertz;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dimension } from "../lib/Dimension";
|
|
2
|
+
/** Illuminance. Base unit: lux. */
|
|
3
|
+
export declare const illuminance: Dimension;
|
|
4
|
+
export declare const lux: import("..").Unit;
|
|
5
|
+
export declare const footCandle: import("..").Unit;
|
|
6
|
+
export declare const phot: import("..").Unit;
|
|
7
|
+
/** Every SI-prefixed lux (kilolux, millilux, microlux, …), keyed by name. */
|
|
8
|
+
export declare const metricIlluminance: Record<string, import("..").Unit>;
|
|
9
|
+
export declare const kilolux: import("..").Unit, millilux: import("..").Unit, microlux: import("..").Unit;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.microlux = exports.millilux = exports.kilolux = exports.metricIlluminance = exports.phot = exports.footCandle = exports.lux = exports.illuminance = void 0;
|
|
4
|
+
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
|
+
/** Illuminance. Base unit: lux. */
|
|
7
|
+
exports.illuminance = new Dimension_1.Dimension("illuminance");
|
|
8
|
+
exports.lux = exports.illuminance.base("lux", { symbol: "lx" });
|
|
9
|
+
exports.footCandle = exports.illuminance.unit("footCandle", 10.764, {
|
|
10
|
+
symbol: "fc",
|
|
11
|
+
aliases: ["ft-c"],
|
|
12
|
+
});
|
|
13
|
+
exports.phot = exports.illuminance.unit("phot", 10000, { symbol: "ph", plural: "phots" });
|
|
14
|
+
/** Every SI-prefixed lux (kilolux, millilux, microlux, …), keyed by name. */
|
|
15
|
+
exports.metricIlluminance = (0, definePrefixed_1.definePrefixed)(exports.illuminance, exports.lux);
|
|
16
|
+
exports.kilolux = exports.metricIlluminance.kilolux, exports.millilux = exports.metricIlluminance.millilux, exports.microlux = exports.metricIlluminance.microlux;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
export * from "./angle";
|
|
2
|
+
export * from "./area";
|
|
3
|
+
export * from "./data";
|
|
4
|
+
export * from "./energy";
|
|
2
5
|
export * from "./force";
|
|
6
|
+
export * from "./frequency";
|
|
7
|
+
export * from "./illuminance";
|
|
3
8
|
export * from "./length";
|
|
9
|
+
export * from "./luminance";
|
|
10
|
+
export * from "./luminousIntensity";
|
|
4
11
|
export * from "./mass";
|
|
12
|
+
export * from "./power";
|
|
13
|
+
export * from "./pressure";
|
|
5
14
|
export * from "./temperature";
|
|
6
15
|
export * from "./time";
|
|
7
16
|
export * from "./volume";
|
package/dist/dimensions/index.js
CHANGED
|
@@ -15,9 +15,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./angle"), exports);
|
|
18
|
+
__exportStar(require("./area"), exports);
|
|
19
|
+
__exportStar(require("./data"), exports);
|
|
20
|
+
__exportStar(require("./energy"), exports);
|
|
18
21
|
__exportStar(require("./force"), exports);
|
|
22
|
+
__exportStar(require("./frequency"), exports);
|
|
23
|
+
__exportStar(require("./illuminance"), exports);
|
|
19
24
|
__exportStar(require("./length"), exports);
|
|
25
|
+
__exportStar(require("./luminance"), exports);
|
|
26
|
+
__exportStar(require("./luminousIntensity"), exports);
|
|
20
27
|
__exportStar(require("./mass"), exports);
|
|
28
|
+
__exportStar(require("./power"), exports);
|
|
29
|
+
__exportStar(require("./pressure"), exports);
|
|
21
30
|
__exportStar(require("./temperature"), exports);
|
|
22
31
|
__exportStar(require("./time"), exports);
|
|
23
32
|
__exportStar(require("./volume"), exports);
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nanometer = exports.micrometer = exports.millimeter = exports.centimeter = exports.decimeter = exports.decameter = exports.hectometer = exports.kilometer = exports.metricLength = exports.mile = exports.yard = exports.foot = exports.inch = exports.meter = exports.length = void 0;
|
|
4
4
|
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
-
const
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
6
|
/** Length / distance. Base unit: meter. */
|
|
7
7
|
exports.length = new Dimension_1.Dimension("length");
|
|
8
|
-
exports.meter = exports.length.base("meter",
|
|
8
|
+
exports.meter = exports.length.base("meter", { symbol: "m", plural: "meters" });
|
|
9
9
|
// Imperial / US customary.
|
|
10
|
-
exports.inch = exports.length.unit("inch", 0.0254,
|
|
11
|
-
exports.foot = exports.length.unit("foot", 0.3048,
|
|
12
|
-
exports.yard = exports.length.unit("yard", 0.9144,
|
|
13
|
-
exports.mile = exports.length.unit("mile", 1609.344,
|
|
10
|
+
exports.inch = exports.length.unit("inch", 0.0254, { symbol: "in", plural: "inches" });
|
|
11
|
+
exports.foot = exports.length.unit("foot", 0.3048, { symbol: "ft", plural: "feet" });
|
|
12
|
+
exports.yard = exports.length.unit("yard", 0.9144, { symbol: "yd", plural: "yards" });
|
|
13
|
+
exports.mile = exports.length.unit("mile", 1609.344, { symbol: "mi", plural: "miles" });
|
|
14
14
|
/** Every SI-prefixed meter (kilometer, centimeter, micrometer, …), keyed by name. */
|
|
15
|
-
exports.metricLength = (0,
|
|
15
|
+
exports.metricLength = (0, definePrefixed_1.definePrefixed)(exports.length, exports.meter);
|
|
16
16
|
exports.kilometer = exports.metricLength.kilometer, exports.hectometer = exports.metricLength.hectometer, exports.decameter = exports.metricLength.decameter, exports.decimeter = exports.metricLength.decimeter, exports.centimeter = exports.metricLength.centimeter, exports.millimeter = exports.metricLength.millimeter, exports.micrometer = exports.metricLength.micrometer, exports.nanometer = exports.metricLength.nanometer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Dimension } from "../lib/Dimension";
|
|
2
|
+
/** Luminance. Base unit: candela per square meter (the nit). */
|
|
3
|
+
export declare const luminance: Dimension;
|
|
4
|
+
export declare const candelaPerSquareMeter: import("..").Unit;
|
|
5
|
+
export declare const stilb: import("..").Unit;
|
|
6
|
+
/** Alias for {@link candelaPerSquareMeter}. */
|
|
7
|
+
export declare const nit: import("..").Unit;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nit = exports.stilb = exports.candelaPerSquareMeter = exports.luminance = void 0;
|
|
4
|
+
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
+
/** Luminance. Base unit: candela per square meter (the nit). */
|
|
6
|
+
exports.luminance = new Dimension_1.Dimension("luminance");
|
|
7
|
+
exports.candelaPerSquareMeter = exports.luminance.base("candelaPerSquareMeter", {
|
|
8
|
+
symbol: "cd/m²",
|
|
9
|
+
aliases: ["cd/m2", "nit", "nits", "nt"],
|
|
10
|
+
});
|
|
11
|
+
exports.stilb = exports.luminance.unit("stilb", 1e4, { symbol: "sb" });
|
|
12
|
+
/** Alias for {@link candelaPerSquareMeter}. */
|
|
13
|
+
exports.nit = exports.candelaPerSquareMeter;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dimension } from "../lib/Dimension";
|
|
2
|
+
/** Luminous intensity. Base unit: candela. */
|
|
3
|
+
export declare const luminousIntensity: Dimension;
|
|
4
|
+
export declare const candela: import("..").Unit;
|
|
5
|
+
export declare const candlepower: import("..").Unit;
|
|
6
|
+
export declare const hefnerkerze: import("..").Unit;
|
|
7
|
+
/** Every SI-prefixed candela (kilocandela, millicandela, …), keyed by name. */
|
|
8
|
+
export declare const metricLuminousIntensity: Record<string, import("..").Unit>;
|
|
9
|
+
export declare const kilocandela: import("..").Unit, millicandela: import("..").Unit, microcandela: import("..").Unit;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.microcandela = exports.millicandela = exports.kilocandela = exports.metricLuminousIntensity = exports.hefnerkerze = exports.candlepower = exports.candela = exports.luminousIntensity = void 0;
|
|
4
|
+
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
|
+
/** Luminous intensity. Base unit: candela. */
|
|
7
|
+
exports.luminousIntensity = new Dimension_1.Dimension("luminousIntensity");
|
|
8
|
+
exports.candela = exports.luminousIntensity.base("candela", { symbol: "cd", plural: "candelas" });
|
|
9
|
+
exports.candlepower = exports.luminousIntensity.unit("candlepower", 1, {
|
|
10
|
+
symbol: "cp",
|
|
11
|
+
aliases: ["CP"],
|
|
12
|
+
});
|
|
13
|
+
exports.hefnerkerze = exports.luminousIntensity.unit("hefnerkerze", 0.92, { symbol: "HK" });
|
|
14
|
+
/** Every SI-prefixed candela (kilocandela, millicandela, …), keyed by name. */
|
|
15
|
+
exports.metricLuminousIntensity = (0, definePrefixed_1.definePrefixed)(exports.luminousIntensity, exports.candela);
|
|
16
|
+
exports.kilocandela = exports.metricLuminousIntensity.kilocandela, exports.millicandela = exports.metricLuminousIntensity.millicandela, exports.microcandela = exports.metricLuminousIntensity.microcandela;
|
package/dist/dimensions/mass.js
CHANGED
|
@@ -2,23 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nanogram = exports.microgram = exports.milligram = exports.centigram = exports.decigram = exports.decagram = exports.hectogram = exports.megagram = exports.kilogram = exports.metricMass = exports.longTon = exports.shortTon = exports.tonne = exports.stone = exports.ounce = exports.pound = exports.gram = exports.mass = void 0;
|
|
4
4
|
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
-
const
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
6
|
/**
|
|
7
7
|
* Mass / weight. Base unit: gram. (SI's official base is the kilogram, but
|
|
8
8
|
* prefixes attach to the gram, so gram is the natural routing anchor — the
|
|
9
9
|
* choice of base is internal and does not affect any conversion.)
|
|
10
10
|
*/
|
|
11
11
|
exports.mass = new Dimension_1.Dimension("mass");
|
|
12
|
-
exports.gram = exports.mass.base("gram",
|
|
12
|
+
exports.gram = exports.mass.base("gram", { symbol: "g", plural: "grams" });
|
|
13
13
|
// Customary units, expressed in grams.
|
|
14
|
-
exports.pound = exports.mass.unit("pound", 453.59237,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
exports.pound = exports.mass.unit("pound", 453.59237, {
|
|
15
|
+
symbol: "lb",
|
|
16
|
+
plural: "pounds",
|
|
17
|
+
aliases: ["lbs"],
|
|
18
|
+
});
|
|
19
|
+
exports.ounce = exports.mass.unit("ounce", 28.349523125, { symbol: "oz", plural: "ounces" });
|
|
20
|
+
exports.stone = exports.mass.unit("stone", 6350.29318, { symbol: "st", plural: "stones" });
|
|
21
|
+
exports.tonne = exports.mass.unit("tonne", 1000000, { symbol: "t", plural: "tonnes" });
|
|
18
22
|
// Short (US) and long (Imperial) tons share the "ton" alias but differ in size;
|
|
19
23
|
// the metric tonne above is a separate unit again. Parsing disambiguates these.
|
|
20
|
-
exports.shortTon = exports.mass.unit("shortTon", 907184.74,
|
|
21
|
-
exports.longTon = exports.mass.unit("longTon", 1016046.9088,
|
|
24
|
+
exports.shortTon = exports.mass.unit("shortTon", 907184.74, { plural: "tons", aliases: ["ton"] });
|
|
25
|
+
exports.longTon = exports.mass.unit("longTon", 1016046.9088, { plural: "tons", aliases: ["ton"] });
|
|
22
26
|
/** Every SI-prefixed gram — including the kilogram — keyed by name. */
|
|
23
|
-
exports.metricMass = (0,
|
|
27
|
+
exports.metricMass = (0, definePrefixed_1.definePrefixed)(exports.mass, exports.gram);
|
|
24
28
|
exports.kilogram = exports.metricMass.kilogram, exports.megagram = exports.metricMass.megagram, exports.hectogram = exports.metricMass.hectogram, exports.decagram = exports.metricMass.decagram, exports.decigram = exports.metricMass.decigram, exports.centigram = exports.metricMass.centigram, exports.milligram = exports.metricMass.milligram, exports.microgram = exports.metricMass.microgram, exports.nanogram = exports.metricMass.nanogram;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dimension } from "../lib/Dimension";
|
|
2
|
+
/** Power. Base unit: watt. */
|
|
3
|
+
export declare const power: Dimension;
|
|
4
|
+
export declare const watt: import("..").Unit;
|
|
5
|
+
export declare const horsepower: import("..").Unit;
|
|
6
|
+
export declare const metricHorsepower: import("..").Unit;
|
|
7
|
+
/** Every SI-prefixed watt (kilowatt, megawatt, gigawatt, milliwatt, …), keyed by name. */
|
|
8
|
+
export declare const metricPower: Record<string, import("..").Unit>;
|
|
9
|
+
export declare const kilowatt: import("..").Unit, megawatt: import("..").Unit, gigawatt: import("..").Unit, terawatt: import("..").Unit, milliwatt: import("..").Unit;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.milliwatt = exports.terawatt = exports.gigawatt = exports.megawatt = exports.kilowatt = exports.metricPower = exports.metricHorsepower = exports.horsepower = exports.watt = exports.power = void 0;
|
|
4
|
+
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
|
+
/** Power. Base unit: watt. */
|
|
7
|
+
exports.power = new Dimension_1.Dimension("power");
|
|
8
|
+
exports.watt = exports.power.base("watt", { symbol: "W", plural: "watts" });
|
|
9
|
+
exports.horsepower = exports.power.unit("horsepower", 745.699872, { symbol: "hp" });
|
|
10
|
+
exports.metricHorsepower = exports.power.unit("metricHorsepower", 735.49875, { symbol: "PS" });
|
|
11
|
+
/** Every SI-prefixed watt (kilowatt, megawatt, gigawatt, milliwatt, …), keyed by name. */
|
|
12
|
+
exports.metricPower = (0, definePrefixed_1.definePrefixed)(exports.power, exports.watt);
|
|
13
|
+
exports.kilowatt = exports.metricPower.kilowatt, exports.megawatt = exports.metricPower.megawatt, exports.gigawatt = exports.metricPower.gigawatt, exports.terawatt = exports.metricPower.terawatt, exports.milliwatt = exports.metricPower.milliwatt;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Dimension } from "../lib/Dimension";
|
|
2
|
+
/** Pressure. Base unit: pascal. */
|
|
3
|
+
export declare const pressure: Dimension;
|
|
4
|
+
export declare const pascal: import("..").Unit;
|
|
5
|
+
export declare const bar: import("..").Unit;
|
|
6
|
+
export declare const millibar: import("..").Unit;
|
|
7
|
+
export declare const atmosphere: import("..").Unit;
|
|
8
|
+
export declare const torr: import("..").Unit;
|
|
9
|
+
export declare const psi: import("..").Unit;
|
|
10
|
+
export declare const inchOfMercury: import("..").Unit;
|
|
11
|
+
export declare const inchOfWater: import("..").Unit;
|
|
12
|
+
/** Every SI-prefixed pascal (kilopascal, hectopascal, megapascal, …), keyed by name. */
|
|
13
|
+
export declare const metricPressure: Record<string, import("..").Unit>;
|
|
14
|
+
export declare const kilopascal: import("..").Unit, hectopascal: import("..").Unit, megapascal: import("..").Unit, gigapascal: import("..").Unit;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gigapascal = exports.megapascal = exports.hectopascal = exports.kilopascal = exports.metricPressure = exports.inchOfWater = exports.inchOfMercury = exports.psi = exports.torr = exports.atmosphere = exports.millibar = exports.bar = exports.pascal = exports.pressure = void 0;
|
|
4
|
+
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
|
+
/** Pressure. Base unit: pascal. */
|
|
7
|
+
exports.pressure = new Dimension_1.Dimension("pressure");
|
|
8
|
+
exports.pascal = exports.pressure.base("pascal", { symbol: "Pa", plural: "pascals" });
|
|
9
|
+
exports.bar = exports.pressure.unit("bar", 1e5, { symbol: "bar", plural: "bars" });
|
|
10
|
+
exports.millibar = exports.pressure.unit("millibar", 1e2, { symbol: "mbar", plural: "millibars" });
|
|
11
|
+
exports.atmosphere = exports.pressure.unit("atmosphere", 101325, {
|
|
12
|
+
symbol: "atm",
|
|
13
|
+
plural: "atmospheres",
|
|
14
|
+
});
|
|
15
|
+
exports.torr = exports.pressure.unit("torr", 101325 / 760, { symbol: "Torr", plural: "torrs" });
|
|
16
|
+
exports.psi = exports.pressure.unit("psi", 6894.757293168, { aliases: ["lbf/in²", "lbf/in2"] });
|
|
17
|
+
exports.inchOfMercury = exports.pressure.unit("inchOfMercury", 3386.389, { symbol: "inHg" });
|
|
18
|
+
exports.inchOfWater = exports.pressure.unit("inchOfWater", 249.0889, { symbol: "inAq" });
|
|
19
|
+
/** Every SI-prefixed pascal (kilopascal, hectopascal, megapascal, …), keyed by name. */
|
|
20
|
+
exports.metricPressure = (0, definePrefixed_1.definePrefixed)(exports.pressure, exports.pascal);
|
|
21
|
+
exports.kilopascal = exports.metricPressure.kilopascal, exports.hectopascal = exports.metricPressure.hectopascal, exports.megapascal = exports.metricPressure.megapascal, exports.gigapascal = exports.metricPressure.gigapascal;
|
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fahrenheit = exports.celsius = exports.kelvin = exports.temperature = void 0;
|
|
4
4
|
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
+
const Rational_1 = require("../lib/Rational");
|
|
5
6
|
/**
|
|
6
7
|
* Temperature. Base unit: kelvin. Uses affine units because Celsius and
|
|
7
8
|
* Fahrenheit are offset from the base, not just scaled.
|
|
8
9
|
*/
|
|
9
10
|
exports.temperature = new Dimension_1.Dimension("temperature");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// Fahrenheit's 5/9 ratio is not a terminating decimal, so it is given as an
|
|
12
|
+
// exact Rational; the offset (273.15 − 32 × 5/9 K) is then derived in exact
|
|
13
|
+
// rational arithmetic so conversions round-trip without drift.
|
|
14
|
+
const fahrenheitScale = new Rational_1.Rational(5, 9);
|
|
15
|
+
const fahrenheitOffset = Rational_1.Rational.from(273.15).minus(new Rational_1.Rational(32).times(fahrenheitScale));
|
|
16
|
+
exports.kelvin = exports.temperature.base("kelvin", { symbol: "K" });
|
|
17
|
+
exports.celsius = exports.temperature.affine("celsius", { scale: 1, offset: 273.15 }, { symbol: "°C", aliases: ["C"] });
|
|
18
|
+
exports.fahrenheit = exports.temperature.affine("fahrenheit", { scale: fahrenheitScale, offset: fahrenheitOffset }, { symbol: "°F", aliases: ["F"] });
|
package/dist/dimensions/time.js
CHANGED
|
@@ -2,17 +2,29 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.picosecond = exports.nanosecond = exports.microsecond = exports.millisecond = exports.metricTime = exports.week = exports.day = exports.hour = exports.minute = exports.second = exports.time = void 0;
|
|
4
4
|
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
-
const
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
6
|
/** Time / duration. Base unit: second. */
|
|
7
7
|
exports.time = new Dimension_1.Dimension("time");
|
|
8
|
-
exports.second = exports.time.base("second",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
exports.second = exports.time.base("second", {
|
|
9
|
+
symbol: "s",
|
|
10
|
+
plural: "seconds",
|
|
11
|
+
aliases: ["sec", "secs"],
|
|
12
|
+
});
|
|
13
|
+
exports.minute = exports.time.unit("minute", 60, {
|
|
14
|
+
symbol: "min",
|
|
15
|
+
plural: "minutes",
|
|
16
|
+
aliases: ["mins"],
|
|
17
|
+
});
|
|
18
|
+
exports.hour = exports.time.unit("hour", 3600, {
|
|
19
|
+
symbol: "h",
|
|
20
|
+
plural: "hours",
|
|
21
|
+
aliases: ["hr", "hrs"],
|
|
22
|
+
});
|
|
23
|
+
exports.day = exports.time.unit("day", 86400, { symbol: "d", plural: "days" });
|
|
24
|
+
exports.week = exports.time.unit("week", 604800, { symbol: "wk", plural: "weeks" });
|
|
13
25
|
/**
|
|
14
26
|
* SI-submultiple seconds (millisecond, microsecond, nanosecond, …). Only
|
|
15
27
|
* fractions are generated; larger spans use minute/hour/day/week above.
|
|
16
28
|
*/
|
|
17
|
-
exports.metricTime = (0,
|
|
29
|
+
exports.metricTime = (0, definePrefixed_1.definePrefixed)(exports.time, exports.second, definePrefixed_1.SI_SUBMULTIPLE_PREFIXES);
|
|
18
30
|
exports.millisecond = exports.metricTime.millisecond, exports.microsecond = exports.metricTime.microsecond, exports.nanosecond = exports.metricTime.nanosecond, exports.picosecond = exports.metricTime.picosecond;
|
|
@@ -2,36 +2,69 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.milliliter = exports.centiliter = exports.deciliter = exports.decaliter = exports.hectoliter = exports.kiloliter = exports.metricVolume = exports.teaspoon = exports.tablespoon = exports.cup = exports.imperialFluidOunce = exports.imperialGill = exports.imperialPint = exports.imperialQuart = exports.imperialGallon = exports.usFluidOunce = exports.usGill = exports.usPint = exports.usQuart = exports.usGallon = exports.liter = exports.volume = void 0;
|
|
4
4
|
const Dimension_1 = require("../lib/Dimension");
|
|
5
|
-
const
|
|
5
|
+
const definePrefixed_1 = require("../utils/definePrefixed");
|
|
6
6
|
/** Volume / capacity. Base unit: liter. */
|
|
7
7
|
exports.volume = new Dimension_1.Dimension("volume");
|
|
8
|
-
exports.liter = exports.volume.base("liter",
|
|
8
|
+
exports.liter = exports.volume.base("liter", { symbol: "L", plural: "liters" });
|
|
9
9
|
// US and Imperial liquid measures share names ("gallon", "pint", …) but differ
|
|
10
10
|
// in size, so each is a distinct unit carrying the shared aliases; parsing
|
|
11
11
|
// disambiguates via a preferred measurement system. Imperial has 160 fluid
|
|
12
12
|
// ounces per gallon, US customary has 128.
|
|
13
|
-
exports.usGallon = exports.volume.unit("usGallon", 3.785411784,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
exports.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
exports.usGallon = exports.volume.unit("usGallon", 3.785411784, {
|
|
14
|
+
symbol: "gal",
|
|
15
|
+
plural: "gallons",
|
|
16
|
+
aliases: ["gallon"],
|
|
17
|
+
});
|
|
18
|
+
exports.usQuart = exports.volume.unit("usQuart", 0.946352946, {
|
|
19
|
+
symbol: "qt",
|
|
20
|
+
plural: "quarts",
|
|
21
|
+
aliases: ["quart"],
|
|
22
|
+
});
|
|
23
|
+
exports.usPint = exports.volume.unit("usPint", 0.473176473, {
|
|
24
|
+
symbol: "pt",
|
|
25
|
+
plural: "pints",
|
|
26
|
+
aliases: ["pint"],
|
|
27
|
+
});
|
|
28
|
+
exports.usGill = exports.volume.unit("usGill", 0.11829411825, { plural: "gills", aliases: ["gill"] });
|
|
29
|
+
exports.usFluidOunce = exports.volume.unit("usFluidOunce", 0.0295735295625, {
|
|
30
|
+
symbol: "floz",
|
|
31
|
+
plural: "fluidOunces",
|
|
32
|
+
aliases: ["fluidOunce"],
|
|
33
|
+
});
|
|
34
|
+
exports.imperialGallon = exports.volume.unit("imperialGallon", 4.54609, {
|
|
35
|
+
symbol: "gal",
|
|
36
|
+
plural: "gallons",
|
|
37
|
+
aliases: ["gallon"],
|
|
38
|
+
});
|
|
39
|
+
exports.imperialQuart = exports.volume.unit("imperialQuart", 1.1365225, {
|
|
40
|
+
symbol: "qt",
|
|
41
|
+
plural: "quarts",
|
|
42
|
+
aliases: ["quart"],
|
|
43
|
+
});
|
|
44
|
+
exports.imperialPint = exports.volume.unit("imperialPint", 0.56826125, {
|
|
45
|
+
symbol: "pt",
|
|
46
|
+
plural: "pints",
|
|
47
|
+
aliases: ["pint"],
|
|
48
|
+
});
|
|
49
|
+
exports.imperialGill = exports.volume.unit("imperialGill", 0.1420653125, {
|
|
50
|
+
plural: "gills",
|
|
51
|
+
aliases: ["gill"],
|
|
52
|
+
});
|
|
53
|
+
exports.imperialFluidOunce = exports.volume.unit("imperialFluidOunce", 0.0284130625, {
|
|
54
|
+
symbol: "floz",
|
|
55
|
+
plural: "fluidOunces",
|
|
56
|
+
aliases: ["fluidOunce"],
|
|
57
|
+
});
|
|
31
58
|
// US-only cooking measures (no competing imperial unit, so left unprefixed).
|
|
32
|
-
exports.cup = exports.volume.unit("cup", 0.2365882365,
|
|
33
|
-
exports.tablespoon = exports.volume.unit("tablespoon", 0.01478676478125,
|
|
34
|
-
|
|
59
|
+
exports.cup = exports.volume.unit("cup", 0.2365882365, { plural: "cups" });
|
|
60
|
+
exports.tablespoon = exports.volume.unit("tablespoon", 0.01478676478125, {
|
|
61
|
+
symbol: "tbsp",
|
|
62
|
+
plural: "tablespoons",
|
|
63
|
+
});
|
|
64
|
+
exports.teaspoon = exports.volume.unit("teaspoon", 0.00492892159375, {
|
|
65
|
+
symbol: "tsp",
|
|
66
|
+
plural: "teaspoons",
|
|
67
|
+
});
|
|
35
68
|
/** Every SI-prefixed liter (milliliter, centiliter, kiloliter, …), keyed by name. */
|
|
36
|
-
exports.metricVolume = (0,
|
|
69
|
+
exports.metricVolume = (0, definePrefixed_1.definePrefixed)(exports.volume, exports.liter);
|
|
37
70
|
exports.kiloliter = exports.metricVolume.kiloliter, exports.hectoliter = exports.metricVolume.hectoliter, exports.decaliter = exports.metricVolume.decaliter, exports.deciliter = exports.metricVolume.deciliter, exports.centiliter = exports.metricVolume.centiliter, exports.milliliter = exports.metricVolume.milliliter;
|