@oliasoft-open-source/units 4.7.0 → 5.0.0-beta-1
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/README.md +5 -1
- package/dist/README.md +5 -1
- package/dist/index.cjs +73 -73
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +373 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +327 -325
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -0
- package/dist/interfaces.cjs +0 -2
- package/dist/interfaces.d.cts +2 -0
- package/dist/interfaces.d.ts +2 -16
- package/dist/interfaces.js +1 -1
- package/dist/interfaces2.d.cts +17 -0
- package/dist/interfaces2.d.cts.map +1 -0
- package/dist/interfaces2.d.ts +17 -0
- package/dist/interfaces2.d.ts.map +1 -0
- package/dist/numbers/numbers.cjs +6 -11
- package/dist/numbers/numbers.d.cts +8 -0
- package/dist/numbers/numbers.d.cts.map +1 -0
- package/dist/numbers/numbers.d.ts +3 -2
- package/dist/numbers/numbers.d.ts.map +1 -1
- package/dist/numbers/numbers.js +2 -2
- package/dist/units.cjs +30 -35
- package/dist/units.d.cts +34 -0
- package/dist/units.d.cts.map +1 -0
- package/dist/units.d.ts +4 -3
- package/dist/units.d.ts.map +1 -1
- package/dist/units.js +2 -2
- package/dist/units2.cjs +3563 -0
- package/dist/units2.cjs.map +1 -0
- package/dist/units2.js +3149 -0
- package/dist/units2.js.map +1 -0
- package/package.json +85 -26
- package/dist/interfaces.d.ts.map +0 -1
- package/dist/units-BkI5zVBX.cjs +0 -2719
- package/dist/units-DNoJOeDf.js +0 -2649
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sources":["../src/constants.ts","../src/utils.ts","../src/numbers/display-number.ts","../src/rounding/rounding.ts","../src/comparison/comparison.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":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0BACA,OAAA,GAAS,aAAA;AAAA,cAmBE,aAAA,GACX,CAAA,OACA,CAAA,OACA,OAAA,GAAS,aAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { $ as displayNumber, A as DEPRECATED_UNITS, B as asFraction, C as unum, D as withPrettyUnitLabel, E as validateNumber, F as QUANTITIES_DESCRIPTION, G as fraction, H as cleanNum, I as UNITS_DESCRIPTION, J as isFraction, K as getNumberOfDigitsToShow, L as UNIT_ALIASES, M as KNOWN_CONVERSIONS, N as KNOWN_UNITS, O as withUnit, P as LABELS, Q as stripLeadingZeros, R as UNIT_FROM_KEY, S as unitFromQuantity, T as validateAndClean, U as cleanNumStr, V as charCount, W as formatNumber, X as isNumeric, Y as isNonNumerical, Z as numFraction, _ as showAltUnitsList, a as convertAndGetValue, at as roundToDecimalPrecision, b as toBase, c as convertTable, ct as isCloseTo, d as getUnit, dt as isDeepCloseTo, et as displayNumberToFixed, f as getUnitsForQuantity, ft as isScientificStringNum, g as roundNumberWithLabel, h as label, ht as toString, i as checkAndCleanDecimalComma, it as roundByRange, j as INTERMEDIATE_CONVERSIONS, k as ALT_UNITS, l as getAltUnitsListByQuantity, lt as isCloseToOrGreaterThan, m as isValueWithUnit, mt as toNum, nt as roundByMagnitude, o as convertAndGetValueStrict, ot as roundToFixed, p as getValue, pt as isValidNum, q as isEmptyValueWithUnit, r as altUnitsList, rt as roundByMagnitudeToFixed, s as convertSamePrecision, st as roundToPrecision, tt as round, u as getQuantities, ut as isCloseToOrLessThan, v as split, w as unumWithUnit, x as unitFromKey, y as to, z as allNumbers } from "./units2.js";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
/* istanbul ignore file */
|
|
4
|
+
//#endregion
|
|
5
|
+
export { ALT_UNITS, DEPRECATED_UNITS, INTERMEDIATE_CONVERSIONS, KNOWN_CONVERSIONS, KNOWN_UNITS, LABELS, QUANTITIES_DESCRIPTION, UNITS_DESCRIPTION, UNIT_ALIASES, UNIT_FROM_KEY, allNumbers, altUnitsList, asFraction, charCount, checkAndCleanDecimalComma, cleanNum, cleanNumStr, convertAndGetValue, convertAndGetValueStrict, convertSamePrecision, convertTable, displayNumber, displayNumberToFixed, formatNumber, fraction, getAltUnitsListByQuantity, getNumberOfDigitsToShow, getQuantities, getUnit, getUnitsForQuantity, getValue, isCloseTo, isCloseToOrGreaterThan, isCloseToOrLessThan, isDeepCloseTo, isEmptyValueWithUnit, isFraction, isNonNumerical, isNumeric, isScientificStringNum, isValidNum, isValueWithUnit, label, numFraction, round, roundByMagnitude, roundByMagnitudeToFixed, roundByRange, roundNumberWithLabel, roundToDecimalPrecision, roundToFixed, roundToPrecision, showAltUnitsList, split, stripLeadingZeros, to, toBase, toNum, toString, unitFromKey, unitFromQuantity, unum, unumWithUnit, validateAndClean, validateNumber, withPrettyUnitLabel, withUnit };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\nimport {\n label,\n showAltUnitsList,\n getAltUnitsListByQuantity,\n checkAndCleanDecimalComma,\n unitFromKey,\n to,\n split,\n unum,\n toBase,\n altUnitsList,\n convertTable,\n roundNumberWithLabel,\n withUnit,\n unumWithUnit,\n validateAndClean,\n isValueWithUnit,\n getValue,\n getUnit,\n convertSamePrecision,\n convertAndGetValue,\n convertAndGetValueStrict,\n getUnitsForQuantity,\n getQuantities,\n unitFromQuantity,\n withPrettyUnitLabel,\n validateNumber,\n} from './units.ts';\n\nimport {\n ALT_UNITS,\n LABELS,\n UNIT_FROM_KEY,\n KNOWN_CONVERSIONS,\n DEPRECATED_UNITS,\n UNIT_ALIASES,\n INTERMEDIATE_CONVERSIONS,\n KNOWN_UNITS,\n QUANTITIES_DESCRIPTION,\n UNITS_DESCRIPTION,\n} from './constants.ts';\n\nimport {\n isNumeric,\n isNonNumerical,\n isEmptyValueWithUnit,\n allNumbers,\n formatNumber,\n charCount,\n getNumberOfDigitsToShow,\n fraction,\n isFraction,\n asFraction,\n numFraction,\n cleanNumStr,\n cleanNum,\n stripLeadingZeros,\n} from './utils.ts';\n\nimport {\n toNum,\n toString,\n isValidNum,\n isScientificStringNum,\n} from './numbers/numbers.ts';\n\nimport {\n displayNumber,\n displayNumberToFixed,\n} from './numbers/display-number.ts';\n\nimport {\n round,\n roundToFixed,\n roundToPrecision,\n roundToDecimalPrecision,\n roundByMagnitude,\n roundByMagnitudeToFixed,\n roundByRange,\n} from './rounding/rounding.ts';\n\nimport {\n isCloseTo,\n isDeepCloseTo,\n isCloseToOrLessThan,\n isCloseToOrGreaterThan,\n} from './comparison/comparison.ts';\n\nexport {\n // Units\n label,\n showAltUnitsList,\n getAltUnitsListByQuantity,\n getUnitsForQuantity,\n getQuantities,\n checkAndCleanDecimalComma,\n unitFromKey,\n unitFromQuantity,\n to,\n split,\n unum,\n toBase,\n altUnitsList,\n convertTable,\n roundNumberWithLabel,\n withUnit,\n unumWithUnit,\n validateAndClean,\n isValueWithUnit,\n getValue,\n getUnit,\n convertSamePrecision,\n convertAndGetValue,\n convertAndGetValueStrict,\n withPrettyUnitLabel,\n validateNumber,\n //Rounding\n round,\n roundToFixed,\n roundToPrecision,\n roundToDecimalPrecision,\n roundByMagnitude,\n roundByMagnitudeToFixed,\n roundByRange,\n //Comparison\n isCloseTo,\n isDeepCloseTo,\n isCloseToOrLessThan,\n isCloseToOrGreaterThan,\n // Utils\n isNumeric,\n isNonNumerical,\n isEmptyValueWithUnit,\n allNumbers,\n formatNumber,\n displayNumber,\n displayNumberToFixed,\n charCount,\n getNumberOfDigitsToShow,\n fraction,\n isFraction,\n asFraction,\n numFraction,\n cleanNumStr,\n cleanNum,\n toNum,\n toString,\n isValidNum,\n isScientificStringNum,\n stripLeadingZeros,\n // Constants\n ALT_UNITS,\n LABELS,\n UNIT_FROM_KEY,\n KNOWN_CONVERSIONS,\n DEPRECATED_UNITS,\n UNIT_ALIASES,\n INTERMEDIATE_CONVERSIONS,\n KNOWN_UNITS,\n QUANTITIES_DESCRIPTION,\n UNITS_DESCRIPTION,\n};\n"],"mappings":""}
|
package/dist/interfaces.cjs
CHANGED
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
label: string | undefined;
|
|
4
|
-
}
|
|
5
|
-
interface LocaleFormat {
|
|
6
|
-
thousands: string;
|
|
7
|
-
decimal: string;
|
|
8
|
-
useGrouping: boolean;
|
|
9
|
-
}
|
|
10
|
-
interface ValidateReturn {
|
|
11
|
-
valid: boolean;
|
|
12
|
-
errors: (string | undefined)[] | undefined;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type { AltUnitWithLabel, LocaleFormat, ValidateReturn };
|
|
16
|
-
//# sourceMappingURL=interfaces.d.ts.map
|
|
1
|
+
import { n as LocaleFormat, r as ValidateReturn, t as AltUnitWithLabel } from "./interfaces2.js";
|
|
2
|
+
export { AltUnitWithLabel, LocaleFormat, ValidateReturn };
|
package/dist/interfaces.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/interfaces.d.ts
|
|
2
|
+
interface AltUnitWithLabel {
|
|
3
|
+
unit: string | never;
|
|
4
|
+
label: string | undefined;
|
|
5
|
+
}
|
|
6
|
+
interface LocaleFormat {
|
|
7
|
+
thousands: string;
|
|
8
|
+
decimal: string;
|
|
9
|
+
useGrouping: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface ValidateReturn {
|
|
12
|
+
valid: boolean;
|
|
13
|
+
errors: (string | undefined)[] | undefined;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { LocaleFormat as n, ValidateReturn as r, AltUnitWithLabel as t };
|
|
17
|
+
//# sourceMappingURL=interfaces2.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces2.d.cts","names":[],"sources":["../src/interfaces.ts"],"mappings":";UAAiB,gBAAA;EACf,IAAA;EACA,KAAA;AAAA;AAAA,UAGe,YAAA;EACf,SAAA;EACA,OAAA;EACA,WAAA;AAAA;AAAA,UAGe,cAAA;EACf,KAAA;EACA,MAAA;AAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/interfaces.d.ts
|
|
2
|
+
interface AltUnitWithLabel {
|
|
3
|
+
unit: string | never;
|
|
4
|
+
label: string | undefined;
|
|
5
|
+
}
|
|
6
|
+
interface LocaleFormat {
|
|
7
|
+
thousands: string;
|
|
8
|
+
decimal: string;
|
|
9
|
+
useGrouping: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface ValidateReturn {
|
|
12
|
+
valid: boolean;
|
|
13
|
+
errors: (string | undefined)[] | undefined;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { LocaleFormat as n, ValidateReturn as r, AltUnitWithLabel as t };
|
|
17
|
+
//# sourceMappingURL=interfaces2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces2.d.ts","names":[],"sources":["../src/interfaces.ts"],"mappings":";UAAiB,gBAAA;EACf,IAAA;EACA,KAAA;AAAA;AAAA,UAGe,YAAA;EACf,SAAA;EACA,OAAA;EACA,WAAA;AAAA;AAAA,UAGe,cAAA;EACf,KAAA;EACA,MAAA;AAAA"}
|
package/dist/numbers/numbers.cjs
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.isScientificStringNum = numbers_numbers.isScientificStringNum;
|
|
9
|
-
exports.isValidNum = numbers_numbers.isValidNum;
|
|
10
|
-
exports.toNum = numbers_numbers.toNum;
|
|
11
|
-
exports.toString = numbers_numbers.toString;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_units = require("../units2.cjs");
|
|
3
|
+
exports.isScientificStringNum = require_units.isScientificStringNum;
|
|
4
|
+
exports.isValidNum = require_units.isValidNum;
|
|
5
|
+
exports.toNum = require_units.toNum;
|
|
6
|
+
exports.toString = require_units.toString;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/numbers/numbers.d.ts
|
|
2
|
+
declare const isValidNum: (value: unknown) => boolean;
|
|
3
|
+
declare const isScientificStringNum: (value: unknown) => boolean;
|
|
4
|
+
declare const toNum: (value: unknown, fallback?: number, minimum?: number) => any;
|
|
5
|
+
declare const toString: (value?: unknown) => unknown;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { isScientificStringNum, isValidNum, toNum, toString };
|
|
8
|
+
//# sourceMappingURL=numbers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbers.d.cts","names":[],"sources":["../../src/numbers/numbers.ts"],"mappings":";cAgCa,UAAA,GAAc,KAAA;AAAA,cA6Dd,qBAAA,GAAyB,KAAA;AAAA,cAsBzB,KAAA,GACX,KAAA,WACA,QAAA,WACA,OAAA;AAAA,cAgCW,QAAA,GAAY,KAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
//#region src/numbers/numbers.d.ts
|
|
1
2
|
declare const isValidNum: (value: unknown) => boolean;
|
|
2
3
|
declare const isScientificStringNum: (value: unknown) => boolean;
|
|
3
4
|
declare const toNum: (value: unknown, fallback?: number, minimum?: number) => any;
|
|
4
5
|
declare const toString: (value?: unknown) => unknown;
|
|
5
|
-
|
|
6
|
+
//#endregion
|
|
6
7
|
export { isScientificStringNum, isValidNum, toNum, toString };
|
|
7
|
-
//# sourceMappingURL=numbers.d.ts.map
|
|
8
|
+
//# sourceMappingURL=numbers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numbers.d.ts","sources":["../../src/numbers/numbers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"numbers.d.ts","names":[],"sources":["../../src/numbers/numbers.ts"],"mappings":";cAgCa,UAAA,GAAc,KAAA;AAAA,cA6Dd,qBAAA,GAAyB,KAAA;AAAA,cAsBzB,KAAA,GACX,KAAA,WACA,QAAA,WACA,OAAA;AAAA,cAgCW,QAAA,GAAY,KAAA"}
|
package/dist/numbers/numbers.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ft as isScientificStringNum, ht as toString, mt as toNum, pt as isValidNum } from "../units2.js";
|
|
2
|
+
export { isScientificStringNum, isValidNum, toNum, toString };
|
package/dist/units.cjs
CHANGED
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.unumWithUnit = numbers_numbers.unumWithUnit;
|
|
32
|
-
exports.validateAndClean = numbers_numbers.validateAndClean;
|
|
33
|
-
exports.validateNumber = numbers_numbers.validateNumber;
|
|
34
|
-
exports.withPrettyUnitLabel = numbers_numbers.withPrettyUnitLabel;
|
|
35
|
-
exports.withUnit = numbers_numbers.withUnit;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_units = require("./units2.cjs");
|
|
3
|
+
exports.EXP_NOTATION_RE = require_units.EXP_NOTATION_RE;
|
|
4
|
+
exports.SEPARATOR = require_units.SEPARATOR;
|
|
5
|
+
exports.altUnitsList = require_units.altUnitsList;
|
|
6
|
+
exports.checkAndCleanDecimalComma = require_units.checkAndCleanDecimalComma;
|
|
7
|
+
exports.convertAndGetValue = require_units.convertAndGetValue;
|
|
8
|
+
exports.convertAndGetValueStrict = require_units.convertAndGetValueStrict;
|
|
9
|
+
exports.convertSamePrecision = require_units.convertSamePrecision;
|
|
10
|
+
exports.convertTable = require_units.convertTable;
|
|
11
|
+
exports.getAltUnitsListByQuantity = require_units.getAltUnitsListByQuantity;
|
|
12
|
+
exports.getQuantities = require_units.getQuantities;
|
|
13
|
+
exports.getUnit = require_units.getUnit;
|
|
14
|
+
exports.getUnitsForQuantity = require_units.getUnitsForQuantity;
|
|
15
|
+
exports.getValue = require_units.getValue;
|
|
16
|
+
exports.isValueWithUnit = require_units.isValueWithUnit;
|
|
17
|
+
exports.label = require_units.label;
|
|
18
|
+
exports.roundNumberWithLabel = require_units.roundNumberWithLabel;
|
|
19
|
+
exports.showAltUnitsList = require_units.showAltUnitsList;
|
|
20
|
+
exports.split = require_units.split;
|
|
21
|
+
exports.to = require_units.to;
|
|
22
|
+
exports.toBase = require_units.toBase;
|
|
23
|
+
exports.unitFromKey = require_units.unitFromKey;
|
|
24
|
+
exports.unitFromQuantity = require_units.unitFromQuantity;
|
|
25
|
+
exports.unum = require_units.unum;
|
|
26
|
+
exports.unumWithUnit = require_units.unumWithUnit;
|
|
27
|
+
exports.validateAndClean = require_units.validateAndClean;
|
|
28
|
+
exports.validateNumber = require_units.validateNumber;
|
|
29
|
+
exports.withPrettyUnitLabel = require_units.withPrettyUnitLabel;
|
|
30
|
+
exports.withUnit = require_units.withUnit;
|
package/dist/units.d.cts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { r as ValidateReturn, t as AltUnitWithLabel } from "./interfaces2.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/units.d.ts
|
|
4
|
+
declare const SEPARATOR = "|";
|
|
5
|
+
declare const EXP_NOTATION_RE: RegExp;
|
|
6
|
+
declare function showAltUnitsList(quantityKey: string): string[] | undefined;
|
|
7
|
+
declare function getUnitsForQuantity(quantity: string): string[] | undefined;
|
|
8
|
+
declare function getQuantities(): string[] | undefined;
|
|
9
|
+
declare function label(unitKey: string): string | undefined;
|
|
10
|
+
declare function unitFromKey(quantity: string): string | undefined;
|
|
11
|
+
declare function unitFromQuantity(quantity: string): string | undefined;
|
|
12
|
+
declare function getAltUnitsListByQuantity(quantity: string): AltUnitWithLabel[] | undefined;
|
|
13
|
+
declare function checkAndCleanDecimalComma(val: string | number): string | number;
|
|
14
|
+
declare function to(value: string | number, fromUnit: string, toUnit: string): number;
|
|
15
|
+
declare function split(numWithUnit: string): string[];
|
|
16
|
+
declare function getValue(numWithUnit: string): string;
|
|
17
|
+
declare function getUnit(numWithUnit: string): string;
|
|
18
|
+
declare function unum(numWithUnit: string | number, toUnit: string, fromUnit?: string): number;
|
|
19
|
+
declare function isValueWithUnit(value: string | number): boolean;
|
|
20
|
+
declare function convertAndGetValue(numWithUnit: string | number, toUnit: string, fromUnit?: string): number;
|
|
21
|
+
declare function convertAndGetValueStrict(value: string | number | null, toUnit: string, fromUnit?: string): string | number | null;
|
|
22
|
+
declare function toBase(value: string, quantity: string): number;
|
|
23
|
+
declare function convertTable(toUnitRow: any, table: any, defaultUnitRow?: [], removeFinalUnitsRow?: boolean): string | number[][];
|
|
24
|
+
declare function roundNumberWithLabel(value: string, n?: number): string;
|
|
25
|
+
declare function withUnit(value: string | number | null | undefined, unit: string | null, defaultVal?: string): string;
|
|
26
|
+
declare function unumWithUnit(numWithUnit: string | number, toUnit: string, fromUnit?: string): string;
|
|
27
|
+
declare function convertSamePrecision(numWithUnit: string | number, toUnit: string, digits?: number): string;
|
|
28
|
+
declare function altUnitsList(value: string, quantity: string): (string | undefined)[][];
|
|
29
|
+
declare function validateAndClean(previousValue: string, nextText: string): string;
|
|
30
|
+
declare function withPrettyUnitLabel(valueWithUnits: string): string;
|
|
31
|
+
declare function validateNumber(value: string | number): ValidateReturn;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { EXP_NOTATION_RE, SEPARATOR, altUnitsList, checkAndCleanDecimalComma, convertAndGetValue, convertAndGetValueStrict, convertSamePrecision, convertTable, getAltUnitsListByQuantity, getQuantities, getUnit, getUnitsForQuantity, getValue, isValueWithUnit, label, roundNumberWithLabel, showAltUnitsList, split, to, toBase, unitFromKey, unitFromQuantity, unum, unumWithUnit, validateAndClean, validateNumber, withPrettyUnitLabel, withUnit };
|
|
34
|
+
//# sourceMappingURL=units.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"units.d.cts","names":[],"sources":["../src/units.ts"],"mappings":";;;cA0Ba,SAAA;AAAA,cAEA,eAAA,EAAe,MAAA;AAAA,iBASZ,gBAAA,CAAiB,WAAA;AAAA,iBAUjB,mBAAA,CAAoB,QAAA;AAAA,iBAQpB,aAAA,CAAA;AAAA,iBAUA,KAAA,CAAM,OAAA;AAAA,iBAUN,WAAA,CAAY,QAAA;AAAA,iBAUZ,gBAAA,CAAiB,QAAA;AAAA,iBAUjB,yBAAA,CACd,QAAA,WACC,gBAAA;AAAA,iBAca,yBAAA,CACd,GAAA;AAAA,iBAqBc,EAAA,CACd,KAAA,mBACA,QAAA,UACA,MAAA;AAAA,iBAqFc,KAAA,CAAM,WAAA;AAAA,iBA+BN,QAAA,CAAS,WAAA;AAAA,iBAST,OAAA,CAAQ,WAAA;AAAA,iBAWR,IAAA,CACd,WAAA,mBACA,MAAA,UACA,QAAA;AAAA,iBAsDc,eAAA,CAAgB,KAAA;AAAA,iBAehB,kBAAA,CACd,WAAA,mBACA,MAAA,UACA,QAAA;AAAA,iBAac,wBAAA,CACd,KAAA,0BACA,MAAA,UACA,QAAA;AAAA,iBAwBc,MAAA,CAAO,KAAA,UAAe,QAAA;AAAA,iBAoBtB,YAAA,CACd,SAAA,OACA,KAAA,OACA,cAAA,OACA,mBAAA;AAAA,iBAgDc,oBAAA,CAAqB,KAAA,UAAe,CAAA;AAAA,iBAYpC,QAAA,CACd,KAAA,sCACA,IAAA,iBACA,UAAA;AAAA,iBA2Bc,YAAA,CACd,WAAA,mBACA,MAAA,UACA,QAAA;AAAA,iBAcc,oBAAA,CACd,WAAA,mBACA,MAAA,UACA,MAAA;AAAA,iBAsDc,YAAA,CACd,KAAA,UACA,QAAA;AAAA,iBAuBc,gBAAA,CACd,aAAA,UACA,QAAA;AAAA,iBA0Cc,mBAAA,CAAoB,cAAA;AAAA,iBAMpB,cAAA,CAAe,KAAA,oBAAyB,cAAA"}
|
package/dist/units.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as ValidateReturn, t as AltUnitWithLabel } from "./interfaces2.js";
|
|
2
2
|
|
|
3
|
+
//#region src/units.d.ts
|
|
3
4
|
declare const SEPARATOR = "|";
|
|
4
5
|
declare const EXP_NOTATION_RE: RegExp;
|
|
5
6
|
declare function showAltUnitsList(quantityKey: string): string[] | undefined;
|
|
@@ -28,6 +29,6 @@ declare function altUnitsList(value: string, quantity: string): (string | undefi
|
|
|
28
29
|
declare function validateAndClean(previousValue: string, nextText: string): string;
|
|
29
30
|
declare function withPrettyUnitLabel(valueWithUnits: string): string;
|
|
30
31
|
declare function validateNumber(value: string | number): ValidateReturn;
|
|
31
|
-
|
|
32
|
+
//#endregion
|
|
32
33
|
export { EXP_NOTATION_RE, SEPARATOR, altUnitsList, checkAndCleanDecimalComma, convertAndGetValue, convertAndGetValueStrict, convertSamePrecision, convertTable, getAltUnitsListByQuantity, getQuantities, getUnit, getUnitsForQuantity, getValue, isValueWithUnit, label, roundNumberWithLabel, showAltUnitsList, split, to, toBase, unitFromKey, unitFromQuantity, unum, unumWithUnit, validateAndClean, validateNumber, withPrettyUnitLabel, withUnit };
|
|
33
|
-
//# sourceMappingURL=units.d.ts.map
|
|
34
|
+
//# sourceMappingURL=units.d.ts.map
|
package/dist/units.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"units.d.ts","sources":["../src/units.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"units.d.ts","names":[],"sources":["../src/units.ts"],"mappings":";;;cA0Ba,SAAA;AAAA,cAEA,eAAA,EAAe,MAAA;AAAA,iBASZ,gBAAA,CAAiB,WAAA;AAAA,iBAUjB,mBAAA,CAAoB,QAAA;AAAA,iBAQpB,aAAA,CAAA;AAAA,iBAUA,KAAA,CAAM,OAAA;AAAA,iBAUN,WAAA,CAAY,QAAA;AAAA,iBAUZ,gBAAA,CAAiB,QAAA;AAAA,iBAUjB,yBAAA,CACd,QAAA,WACC,gBAAA;AAAA,iBAca,yBAAA,CACd,GAAA;AAAA,iBAqBc,EAAA,CACd,KAAA,mBACA,QAAA,UACA,MAAA;AAAA,iBAqFc,KAAA,CAAM,WAAA;AAAA,iBA+BN,QAAA,CAAS,WAAA;AAAA,iBAST,OAAA,CAAQ,WAAA;AAAA,iBAWR,IAAA,CACd,WAAA,mBACA,MAAA,UACA,QAAA;AAAA,iBAsDc,eAAA,CAAgB,KAAA;AAAA,iBAehB,kBAAA,CACd,WAAA,mBACA,MAAA,UACA,QAAA;AAAA,iBAac,wBAAA,CACd,KAAA,0BACA,MAAA,UACA,QAAA;AAAA,iBAwBc,MAAA,CAAO,KAAA,UAAe,QAAA;AAAA,iBAoBtB,YAAA,CACd,SAAA,OACA,KAAA,OACA,cAAA,OACA,mBAAA;AAAA,iBAgDc,oBAAA,CAAqB,KAAA,UAAe,CAAA;AAAA,iBAYpC,QAAA,CACd,KAAA,sCACA,IAAA,iBACA,UAAA;AAAA,iBA2Bc,YAAA,CACd,WAAA,mBACA,MAAA,UACA,QAAA;AAAA,iBAcc,oBAAA,CACd,WAAA,mBACA,MAAA,UACA,MAAA;AAAA,iBAsDc,YAAA,CACd,KAAA,UACA,QAAA;AAAA,iBAuBc,gBAAA,CACd,aAAA,UACA,QAAA;AAAA,iBA0Cc,mBAAA,CAAoB,cAAA;AAAA,iBAMpB,cAAA,CAAe,KAAA,oBAAyB,cAAA"}
|
package/dist/units.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { C as unum, D as withPrettyUnitLabel, E as validateNumber, O as withUnit, S as unitFromQuantity, T as validateAndClean, _ as showAltUnitsList, a as convertAndGetValue, b as toBase, c as convertTable, d as getUnit, f as getUnitsForQuantity, g as roundNumberWithLabel, h as label, i as checkAndCleanDecimalComma, l as getAltUnitsListByQuantity, m as isValueWithUnit, n as SEPARATOR, o as convertAndGetValueStrict, p as getValue, r as altUnitsList, s as convertSamePrecision, t as EXP_NOTATION_RE, u as getQuantities, v as split, w as unumWithUnit, x as unitFromKey, y as to } from "./units2.js";
|
|
2
|
+
export { EXP_NOTATION_RE, SEPARATOR, altUnitsList, checkAndCleanDecimalComma, convertAndGetValue, convertAndGetValueStrict, convertSamePrecision, convertTable, getAltUnitsListByQuantity, getQuantities, getUnit, getUnitsForQuantity, getValue, isValueWithUnit, label, roundNumberWithLabel, showAltUnitsList, split, to, toBase, unitFromKey, unitFromQuantity, unum, unumWithUnit, validateAndClean, validateNumber, withPrettyUnitLabel, withUnit };
|