@oliasoft-open-source/units 4.7.0 → 5.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/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/README.md
CHANGED
|
@@ -34,7 +34,11 @@ I.e. it support both . and , as comma/thousands separator, exponents and fractio
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
npm i @oliasoft/units --save
|
|
37
|
+
npm i @oliasoft-open-source/units --save
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import { convertAndGetValue, withUnit } from '@oliasoft-open-source/units';
|
|
38
42
|
```
|
|
39
43
|
|
|
40
44
|
## Basic usage
|
package/dist/README.md
CHANGED
|
@@ -34,7 +34,11 @@ I.e. it support both . and , as comma/thousands separator, exponents and fractio
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
npm i @oliasoft/units --save
|
|
37
|
+
npm i @oliasoft-open-source/units --save
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import { convertAndGetValue, withUnit } from '@oliasoft-open-source/units';
|
|
38
42
|
```
|
|
39
43
|
|
|
40
44
|
## Basic usage
|
package/dist/index.cjs
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_units = require("./units2.cjs");
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
/* istanbul ignore file */
|
|
5
|
+
//#endregion
|
|
6
|
+
exports.ALT_UNITS = require_units.ALT_UNITS;
|
|
7
|
+
exports.DEPRECATED_UNITS = require_units.DEPRECATED_UNITS;
|
|
8
|
+
exports.INTERMEDIATE_CONVERSIONS = require_units.INTERMEDIATE_CONVERSIONS;
|
|
9
|
+
exports.KNOWN_CONVERSIONS = require_units.KNOWN_CONVERSIONS;
|
|
10
|
+
exports.KNOWN_UNITS = require_units.KNOWN_UNITS;
|
|
11
|
+
exports.LABELS = require_units.LABELS;
|
|
12
|
+
exports.QUANTITIES_DESCRIPTION = require_units.QUANTITIES_DESCRIPTION;
|
|
13
|
+
exports.UNITS_DESCRIPTION = require_units.UNITS_DESCRIPTION;
|
|
14
|
+
exports.UNIT_ALIASES = require_units.UNIT_ALIASES;
|
|
15
|
+
exports.UNIT_FROM_KEY = require_units.UNIT_FROM_KEY;
|
|
16
|
+
exports.allNumbers = require_units.allNumbers;
|
|
17
|
+
exports.altUnitsList = require_units.altUnitsList;
|
|
18
|
+
exports.asFraction = require_units.asFraction;
|
|
19
|
+
exports.charCount = require_units.charCount;
|
|
20
|
+
exports.checkAndCleanDecimalComma = require_units.checkAndCleanDecimalComma;
|
|
21
|
+
exports.cleanNum = require_units.cleanNum;
|
|
22
|
+
exports.cleanNumStr = require_units.cleanNumStr;
|
|
23
|
+
exports.convertAndGetValue = require_units.convertAndGetValue;
|
|
24
|
+
exports.convertAndGetValueStrict = require_units.convertAndGetValueStrict;
|
|
25
|
+
exports.convertSamePrecision = require_units.convertSamePrecision;
|
|
26
|
+
exports.convertTable = require_units.convertTable;
|
|
27
|
+
exports.displayNumber = require_units.displayNumber;
|
|
28
|
+
exports.displayNumberToFixed = require_units.displayNumberToFixed;
|
|
29
|
+
exports.formatNumber = require_units.formatNumber;
|
|
30
|
+
exports.fraction = require_units.fraction;
|
|
31
|
+
exports.getAltUnitsListByQuantity = require_units.getAltUnitsListByQuantity;
|
|
32
|
+
exports.getNumberOfDigitsToShow = require_units.getNumberOfDigitsToShow;
|
|
33
|
+
exports.getQuantities = require_units.getQuantities;
|
|
34
|
+
exports.getUnit = require_units.getUnit;
|
|
35
|
+
exports.getUnitsForQuantity = require_units.getUnitsForQuantity;
|
|
36
|
+
exports.getValue = require_units.getValue;
|
|
37
|
+
exports.isCloseTo = require_units.isCloseTo;
|
|
38
|
+
exports.isCloseToOrGreaterThan = require_units.isCloseToOrGreaterThan;
|
|
39
|
+
exports.isCloseToOrLessThan = require_units.isCloseToOrLessThan;
|
|
40
|
+
exports.isDeepCloseTo = require_units.isDeepCloseTo;
|
|
41
|
+
exports.isEmptyValueWithUnit = require_units.isEmptyValueWithUnit;
|
|
42
|
+
exports.isFraction = require_units.isFraction;
|
|
43
|
+
exports.isNonNumerical = require_units.isNonNumerical;
|
|
44
|
+
exports.isNumeric = require_units.isNumeric;
|
|
45
|
+
exports.isScientificStringNum = require_units.isScientificStringNum;
|
|
46
|
+
exports.isValidNum = require_units.isValidNum;
|
|
47
|
+
exports.isValueWithUnit = require_units.isValueWithUnit;
|
|
48
|
+
exports.label = require_units.label;
|
|
49
|
+
exports.numFraction = require_units.numFraction;
|
|
50
|
+
exports.round = require_units.round;
|
|
51
|
+
exports.roundByMagnitude = require_units.roundByMagnitude;
|
|
52
|
+
exports.roundByMagnitudeToFixed = require_units.roundByMagnitudeToFixed;
|
|
53
|
+
exports.roundByRange = require_units.roundByRange;
|
|
54
|
+
exports.roundNumberWithLabel = require_units.roundNumberWithLabel;
|
|
55
|
+
exports.roundToDecimalPrecision = require_units.roundToDecimalPrecision;
|
|
56
|
+
exports.roundToFixed = require_units.roundToFixed;
|
|
57
|
+
exports.roundToPrecision = require_units.roundToPrecision;
|
|
58
|
+
exports.showAltUnitsList = require_units.showAltUnitsList;
|
|
59
|
+
exports.split = require_units.split;
|
|
60
|
+
exports.stripLeadingZeros = require_units.stripLeadingZeros;
|
|
61
|
+
exports.to = require_units.to;
|
|
62
|
+
exports.toBase = require_units.toBase;
|
|
63
|
+
exports.toNum = require_units.toNum;
|
|
64
|
+
exports.toString = require_units.toString;
|
|
65
|
+
exports.unitFromKey = require_units.unitFromKey;
|
|
66
|
+
exports.unitFromQuantity = require_units.unitFromQuantity;
|
|
67
|
+
exports.unum = require_units.unum;
|
|
68
|
+
exports.unumWithUnit = require_units.unumWithUnit;
|
|
69
|
+
exports.validateAndClean = require_units.validateAndClean;
|
|
70
|
+
exports.validateNumber = require_units.validateNumber;
|
|
71
|
+
exports.withPrettyUnitLabel = require_units.withPrettyUnitLabel;
|
|
72
|
+
exports.withUnit = require_units.withUnit;
|
|
2
73
|
|
|
3
|
-
|
|
4
|
-
require('fraction.js');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.ALT_UNITS = numbers_numbers.ALT_UNITS;
|
|
9
|
-
exports.DEPRECATED_UNITS = numbers_numbers.DEPRECATED_UNITS;
|
|
10
|
-
exports.INTERMEDIATE_CONVERSIONS = numbers_numbers.INTERMEDIATE_CONVERSIONS;
|
|
11
|
-
exports.KNOWN_CONVERSIONS = numbers_numbers.KNOWN_CONVERSIONS;
|
|
12
|
-
exports.KNOWN_UNITS = numbers_numbers.KNOWN_UNITS;
|
|
13
|
-
exports.LABELS = numbers_numbers.LABELS;
|
|
14
|
-
exports.QUANTITIES_DESCRIPTION = numbers_numbers.QUANTITIES_DESCRIPTION;
|
|
15
|
-
exports.UNITS_DESCRIPTION = numbers_numbers.UNITS_DESCRIPTION;
|
|
16
|
-
exports.UNIT_ALIASES = numbers_numbers.UNIT_ALIASES;
|
|
17
|
-
exports.UNIT_FROM_KEY = numbers_numbers.UNIT_FROM_KEY;
|
|
18
|
-
exports.allNumbers = numbers_numbers.allNumbers;
|
|
19
|
-
exports.altUnitsList = numbers_numbers.altUnitsList;
|
|
20
|
-
exports.asFraction = numbers_numbers.asFraction;
|
|
21
|
-
exports.charCount = numbers_numbers.charCount;
|
|
22
|
-
exports.checkAndCleanDecimalComma = numbers_numbers.checkAndCleanDecimalComma;
|
|
23
|
-
exports.cleanNum = numbers_numbers.cleanNum;
|
|
24
|
-
exports.cleanNumStr = numbers_numbers.cleanNumStr;
|
|
25
|
-
exports.convertAndGetValue = numbers_numbers.convertAndGetValue;
|
|
26
|
-
exports.convertAndGetValueStrict = numbers_numbers.convertAndGetValueStrict;
|
|
27
|
-
exports.convertSamePrecision = numbers_numbers.convertSamePrecision;
|
|
28
|
-
exports.convertTable = numbers_numbers.convertTable;
|
|
29
|
-
exports.displayNumber = numbers_numbers.displayNumber;
|
|
30
|
-
exports.displayNumberToFixed = numbers_numbers.displayNumberToFixed;
|
|
31
|
-
exports.formatNumber = numbers_numbers.formatNumber;
|
|
32
|
-
exports.fraction = numbers_numbers.fraction;
|
|
33
|
-
exports.getAltUnitsListByQuantity = numbers_numbers.getAltUnitsListByQuantity;
|
|
34
|
-
exports.getNumberOfDigitsToShow = numbers_numbers.getNumberOfDigitsToShow;
|
|
35
|
-
exports.getQuantities = numbers_numbers.getQuantities;
|
|
36
|
-
exports.getUnit = numbers_numbers.getUnit;
|
|
37
|
-
exports.getUnitsForQuantity = numbers_numbers.getUnitsForQuantity;
|
|
38
|
-
exports.getValue = numbers_numbers.getValue;
|
|
39
|
-
exports.isCloseTo = numbers_numbers.isCloseTo;
|
|
40
|
-
exports.isCloseToOrGreaterThan = numbers_numbers.isCloseToOrGreaterThan;
|
|
41
|
-
exports.isCloseToOrLessThan = numbers_numbers.isCloseToOrLessThan;
|
|
42
|
-
exports.isDeepCloseTo = numbers_numbers.isDeepCloseTo;
|
|
43
|
-
exports.isEmptyValueWithUnit = numbers_numbers.isEmptyValueWithUnit;
|
|
44
|
-
exports.isFraction = numbers_numbers.isFraction;
|
|
45
|
-
exports.isNonNumerical = numbers_numbers.isNonNumerical;
|
|
46
|
-
exports.isNumeric = numbers_numbers.isNumeric;
|
|
47
|
-
exports.isScientificStringNum = numbers_numbers.isScientificStringNum;
|
|
48
|
-
exports.isValidNum = numbers_numbers.isValidNum;
|
|
49
|
-
exports.isValueWithUnit = numbers_numbers.isValueWithUnit;
|
|
50
|
-
exports.label = numbers_numbers.label;
|
|
51
|
-
exports.numFraction = numbers_numbers.numFraction;
|
|
52
|
-
exports.round = numbers_numbers.round;
|
|
53
|
-
exports.roundByMagnitude = numbers_numbers.roundByMagnitude;
|
|
54
|
-
exports.roundByMagnitudeToFixed = numbers_numbers.roundByMagnitudeToFixed;
|
|
55
|
-
exports.roundByRange = numbers_numbers.roundByRange;
|
|
56
|
-
exports.roundNumberWithLabel = numbers_numbers.roundNumberWithLabel;
|
|
57
|
-
exports.roundToDecimalPrecision = numbers_numbers.roundToDecimalPrecision;
|
|
58
|
-
exports.roundToFixed = numbers_numbers.roundToFixed;
|
|
59
|
-
exports.roundToPrecision = numbers_numbers.roundToPrecision;
|
|
60
|
-
exports.showAltUnitsList = numbers_numbers.showAltUnitsList;
|
|
61
|
-
exports.split = numbers_numbers.split;
|
|
62
|
-
exports.stripLeadingZeros = numbers_numbers.stripLeadingZeros;
|
|
63
|
-
exports.to = numbers_numbers.to;
|
|
64
|
-
exports.toBase = numbers_numbers.toBase;
|
|
65
|
-
exports.toNum = numbers_numbers.toNum;
|
|
66
|
-
exports.toString = numbers_numbers.toString;
|
|
67
|
-
exports.unitFromKey = numbers_numbers.unitFromKey;
|
|
68
|
-
exports.unitFromQuantity = numbers_numbers.unitFromQuantity;
|
|
69
|
-
exports.unum = numbers_numbers.unum;
|
|
70
|
-
exports.unumWithUnit = numbers_numbers.unumWithUnit;
|
|
71
|
-
exports.validateAndClean = numbers_numbers.validateAndClean;
|
|
72
|
-
exports.validateNumber = numbers_numbers.validateNumber;
|
|
73
|
-
exports.withPrettyUnitLabel = numbers_numbers.withPrettyUnitLabel;
|
|
74
|
-
exports.withUnit = numbers_numbers.withUnit;
|
|
74
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","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/index.d.cts
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { 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 } from "./units.cjs";
|
|
2
|
+
import { isScientificStringNum, isValidNum, toNum, toString } from "./numbers/numbers.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/constants.d.ts
|
|
5
|
+
declare const LABELS: Record<string, string>;
|
|
6
|
+
declare const ALT_UNITS: Record<string, string[]>;
|
|
7
|
+
declare const UNIT_FROM_KEY: Record<string, string>;
|
|
8
|
+
declare const KNOWN_CONVERSIONS: Record<string, (val: number) => number>;
|
|
9
|
+
declare const DEPRECATED_UNITS: Record<string, string>;
|
|
10
|
+
declare const UNIT_ALIASES: Record<string, string>;
|
|
11
|
+
declare const INTERMEDIATE_CONVERSIONS: Record<string, string>;
|
|
12
|
+
declare const KNOWN_UNITS: readonly string[];
|
|
13
|
+
declare const QUANTITIES_DESCRIPTION: {
|
|
14
|
+
density: string;
|
|
15
|
+
length: string;
|
|
16
|
+
duration: string;
|
|
17
|
+
temperature: string;
|
|
18
|
+
tempgrad: string;
|
|
19
|
+
volume: string;
|
|
20
|
+
weight: string;
|
|
21
|
+
angles: string;
|
|
22
|
+
depth: string;
|
|
23
|
+
distance: string;
|
|
24
|
+
height: string;
|
|
25
|
+
diameters: string;
|
|
26
|
+
doglegSeverity: string;
|
|
27
|
+
fluidCompressibility: string;
|
|
28
|
+
force: string;
|
|
29
|
+
gasVolume: string;
|
|
30
|
+
oilVolume: string;
|
|
31
|
+
moleWeight: string;
|
|
32
|
+
linearCapacity: string;
|
|
33
|
+
stress: string;
|
|
34
|
+
thermalConductivity: string;
|
|
35
|
+
specificHeatCapacity: string;
|
|
36
|
+
thermalExpansionCoefficient: string;
|
|
37
|
+
youngsModulus: string;
|
|
38
|
+
torque: string;
|
|
39
|
+
areaOther: string;
|
|
40
|
+
areaTubular: string;
|
|
41
|
+
pumpRate: string;
|
|
42
|
+
pressure: string;
|
|
43
|
+
blowoutFlowRate: string;
|
|
44
|
+
percentage: string;
|
|
45
|
+
frequency: string;
|
|
46
|
+
torqueGradient: string;
|
|
47
|
+
pressureGradient: string;
|
|
48
|
+
flowrate: string;
|
|
49
|
+
massFlowRate: string;
|
|
50
|
+
angleGradient: string;
|
|
51
|
+
weightGradient: string;
|
|
52
|
+
forceGradient: string;
|
|
53
|
+
interfacialTension: string;
|
|
54
|
+
acceleration: string;
|
|
55
|
+
viscosity: string;
|
|
56
|
+
power: string;
|
|
57
|
+
intensity: string;
|
|
58
|
+
gasliftFlowRate: string;
|
|
59
|
+
productionFlowRate: string;
|
|
60
|
+
productionFlowRateOil: string;
|
|
61
|
+
productionFlowRateGas: string;
|
|
62
|
+
injectionFlowRate: string;
|
|
63
|
+
blowoutOilFlowRate: string;
|
|
64
|
+
blowoutGasFlowRate: string;
|
|
65
|
+
gor: string;
|
|
66
|
+
rotationalSpeed: string;
|
|
67
|
+
densityGas: string;
|
|
68
|
+
inflowProductivityIndex: string;
|
|
69
|
+
latitude: string;
|
|
70
|
+
longitude: string;
|
|
71
|
+
permeability: string;
|
|
72
|
+
sdstats: string;
|
|
73
|
+
roughness: string;
|
|
74
|
+
wltubulars: string;
|
|
75
|
+
speed: string;
|
|
76
|
+
inverseStandSpeed: string;
|
|
77
|
+
rop: string;
|
|
78
|
+
densityOil: string;
|
|
79
|
+
densityOilGas: string;
|
|
80
|
+
kickToleranceVolume: string;
|
|
81
|
+
densitySolid: string;
|
|
82
|
+
massPerLength: string;
|
|
83
|
+
durationShort: string;
|
|
84
|
+
durationLong: string;
|
|
85
|
+
wearFactor: string;
|
|
86
|
+
turbulentSkin: string;
|
|
87
|
+
pressurePerTemperature: string;
|
|
88
|
+
location: string;
|
|
89
|
+
mixingRequirements: string;
|
|
90
|
+
Entalphy: string;
|
|
91
|
+
shearStress: string;
|
|
92
|
+
volumeGradient: string;
|
|
93
|
+
deg: string;
|
|
94
|
+
dls: string;
|
|
95
|
+
wgrad: string;
|
|
96
|
+
entalphy: string;
|
|
97
|
+
pressurechange: string;
|
|
98
|
+
rpm: string;
|
|
99
|
+
sensorAccelerometer: string;
|
|
100
|
+
sensorMagnetometer: string;
|
|
101
|
+
};
|
|
102
|
+
declare const UNITS_DESCRIPTION: {
|
|
103
|
+
in: string;
|
|
104
|
+
mm: string;
|
|
105
|
+
cm: string;
|
|
106
|
+
m: string;
|
|
107
|
+
km: string;
|
|
108
|
+
ft: string;
|
|
109
|
+
usft: string;
|
|
110
|
+
in2: string;
|
|
111
|
+
cm2: string;
|
|
112
|
+
m2: string;
|
|
113
|
+
kg: string;
|
|
114
|
+
tonnes: string;
|
|
115
|
+
mt: string;
|
|
116
|
+
kip: string;
|
|
117
|
+
bbl: string;
|
|
118
|
+
Mm3: string;
|
|
119
|
+
MMSCF: string;
|
|
120
|
+
lbm: string;
|
|
121
|
+
'kg/mol': string;
|
|
122
|
+
'lbf/mol': string;
|
|
123
|
+
sg: string;
|
|
124
|
+
ppg: string;
|
|
125
|
+
'kg/m3': string;
|
|
126
|
+
'lbm/ft3': string;
|
|
127
|
+
s: string;
|
|
128
|
+
min: string;
|
|
129
|
+
h: string;
|
|
130
|
+
d: string;
|
|
131
|
+
month: string;
|
|
132
|
+
year: string;
|
|
133
|
+
'bbl/ft': string;
|
|
134
|
+
lpm: string;
|
|
135
|
+
bpm: string;
|
|
136
|
+
'm3/min': string;
|
|
137
|
+
'm3/s': string;
|
|
138
|
+
MMSCFD: string;
|
|
139
|
+
'1/MMSCFD': string;
|
|
140
|
+
bar: string;
|
|
141
|
+
Pa: string;
|
|
142
|
+
kPa: string;
|
|
143
|
+
MPa: string;
|
|
144
|
+
kPsi: string;
|
|
145
|
+
'kPa/m': string;
|
|
146
|
+
'psi/ft': string;
|
|
147
|
+
'bar/100m': string;
|
|
148
|
+
'psi/100ft': string;
|
|
149
|
+
'kPa/100m': string;
|
|
150
|
+
C: string;
|
|
151
|
+
F: string;
|
|
152
|
+
K: string;
|
|
153
|
+
'C/100m': string;
|
|
154
|
+
'F/100ft': string;
|
|
155
|
+
'K/100m': string;
|
|
156
|
+
'lbf/ft': string;
|
|
157
|
+
'Pa/C': string;
|
|
158
|
+
'Bar/C': string;
|
|
159
|
+
'psi/F': string;
|
|
160
|
+
'psi/C': string;
|
|
161
|
+
N: string;
|
|
162
|
+
kN: string;
|
|
163
|
+
'N/m': string;
|
|
164
|
+
'daN/m': string;
|
|
165
|
+
lbf: string;
|
|
166
|
+
kgf: string;
|
|
167
|
+
rad: string;
|
|
168
|
+
'BTU/lbm': string;
|
|
169
|
+
ppf: string;
|
|
170
|
+
'kg/m': string;
|
|
171
|
+
'E-06/degC': string;
|
|
172
|
+
'E-06/degF': string;
|
|
173
|
+
km2: string;
|
|
174
|
+
ft2: string;
|
|
175
|
+
mm2: string;
|
|
176
|
+
mile2: string;
|
|
177
|
+
ft3: string;
|
|
178
|
+
'g/cm3': string;
|
|
179
|
+
Sm3: string;
|
|
180
|
+
'ft3/s': string;
|
|
181
|
+
'ft3/d': string;
|
|
182
|
+
'm3/d': string;
|
|
183
|
+
'1/m3/d': string;
|
|
184
|
+
's/m3': string;
|
|
185
|
+
'bbl/d': string;
|
|
186
|
+
tonneForce: string;
|
|
187
|
+
USGal: string;
|
|
188
|
+
'g/mol': string;
|
|
189
|
+
Nm: string;
|
|
190
|
+
kNm: string;
|
|
191
|
+
ftlbf: string;
|
|
192
|
+
'J/(kg*degC)': string;
|
|
193
|
+
'J/(kg*degK)': string;
|
|
194
|
+
'BTU/(lbm*degF)': string;
|
|
195
|
+
'BTU/(h*ft*degF)': string;
|
|
196
|
+
l: string;
|
|
197
|
+
'l/m': string;
|
|
198
|
+
'kJ/kg': string;
|
|
199
|
+
'J/kg': string;
|
|
200
|
+
deg: string;
|
|
201
|
+
'W/(mK)': string;
|
|
202
|
+
psi: string;
|
|
203
|
+
'1/bar': string;
|
|
204
|
+
'1/psi': string;
|
|
205
|
+
'deg/100ft': string;
|
|
206
|
+
'deg/10m': string;
|
|
207
|
+
'deg/30m': string;
|
|
208
|
+
'%': string;
|
|
209
|
+
Hz: string;
|
|
210
|
+
'1/s': string;
|
|
211
|
+
rpm: string;
|
|
212
|
+
'Pa/m': string;
|
|
213
|
+
'bar/m': string;
|
|
214
|
+
gpm: string;
|
|
215
|
+
'kg/s': string;
|
|
216
|
+
'lbm/s': string;
|
|
217
|
+
'tonnes/h': string;
|
|
218
|
+
'tons/h': string;
|
|
219
|
+
'deg/m': string;
|
|
220
|
+
'deg/ft': string;
|
|
221
|
+
'rad/m': string;
|
|
222
|
+
'rad/ft': string;
|
|
223
|
+
'dyn/cm': string;
|
|
224
|
+
'mN/m': string;
|
|
225
|
+
'1/kPa': string;
|
|
226
|
+
m3: string;
|
|
227
|
+
'm/s': string;
|
|
228
|
+
'ft/s': string;
|
|
229
|
+
'm/min': string;
|
|
230
|
+
'ft/min': string;
|
|
231
|
+
'm/h': string;
|
|
232
|
+
'ft/h': string;
|
|
233
|
+
mph: string;
|
|
234
|
+
'km/h': string;
|
|
235
|
+
'm/s2': string;
|
|
236
|
+
'ft/s2': string;
|
|
237
|
+
'Pa*s': string;
|
|
238
|
+
P: string;
|
|
239
|
+
'mPa*s': string;
|
|
240
|
+
cP: string;
|
|
241
|
+
W: string;
|
|
242
|
+
hhp: string;
|
|
243
|
+
hp: string;
|
|
244
|
+
kW: string;
|
|
245
|
+
MW: string;
|
|
246
|
+
'BTU/h': string;
|
|
247
|
+
'hhp/in2': string;
|
|
248
|
+
'hhp/ft2': string;
|
|
249
|
+
'Mm3/d': string;
|
|
250
|
+
'STB/d': string;
|
|
251
|
+
'Sm3/d': string;
|
|
252
|
+
'Sm3/min': string;
|
|
253
|
+
'MSm3/d': string;
|
|
254
|
+
'SCF/STB': string;
|
|
255
|
+
'Sm3/Sm3': string;
|
|
256
|
+
'SCF/d': string;
|
|
257
|
+
STB: string;
|
|
258
|
+
SCF: string;
|
|
259
|
+
Gsg: string;
|
|
260
|
+
Gppg: string;
|
|
261
|
+
'Gkg/m3': string;
|
|
262
|
+
'Glbm/ft3': string;
|
|
263
|
+
MSm3: string;
|
|
264
|
+
'm3/s/bar': string;
|
|
265
|
+
'Sm3/d/bar': string;
|
|
266
|
+
'STB/d/psi': string;
|
|
267
|
+
klbf: string;
|
|
268
|
+
'1/Pa': string;
|
|
269
|
+
'1/MPa': string;
|
|
270
|
+
ksi: string;
|
|
271
|
+
'lbf/100ft2': string;
|
|
272
|
+
'lb/ft3': string;
|
|
273
|
+
'\u00B0N': string;
|
|
274
|
+
'\u00B0S': string;
|
|
275
|
+
'\u00B0W': string;
|
|
276
|
+
'\u00B0E': string;
|
|
277
|
+
fr: string;
|
|
278
|
+
mD: string;
|
|
279
|
+
Sigma: string;
|
|
280
|
+
CI: string;
|
|
281
|
+
'J/(s*m*degK)': string;
|
|
282
|
+
'C/m': string;
|
|
283
|
+
'F/ft': string;
|
|
284
|
+
'K/m': string;
|
|
285
|
+
microM: string;
|
|
286
|
+
'W/m2': string;
|
|
287
|
+
'1/K': string;
|
|
288
|
+
'lb/ft': string;
|
|
289
|
+
'E-09/bar': string;
|
|
290
|
+
'E-10/psi': string;
|
|
291
|
+
'E-14/pa': string;
|
|
292
|
+
lk: string;
|
|
293
|
+
ftCla: string;
|
|
294
|
+
lkCla: string;
|
|
295
|
+
ftSe: string;
|
|
296
|
+
ydSe: string;
|
|
297
|
+
chSe: string;
|
|
298
|
+
'chSe(T)': string;
|
|
299
|
+
ftGC: string;
|
|
300
|
+
ydInd: string;
|
|
301
|
+
'd/stand': string;
|
|
302
|
+
'h/stand': string;
|
|
303
|
+
'min/stand': string;
|
|
304
|
+
's/stand': string;
|
|
305
|
+
'm3/t': string;
|
|
306
|
+
'L/100kg': string;
|
|
307
|
+
GPa: string;
|
|
308
|
+
'cm3/m': string;
|
|
309
|
+
'in3/ft': string;
|
|
310
|
+
'ft3/ft': string;
|
|
311
|
+
'm3/m': string;
|
|
312
|
+
'mm3/m': string;
|
|
313
|
+
'1/GPa': string;
|
|
314
|
+
lps: string;
|
|
315
|
+
nT: string;
|
|
316
|
+
Gs: string;
|
|
317
|
+
g: string;
|
|
318
|
+
};
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/utils.d.ts
|
|
321
|
+
declare function isEmptyValueWithUnit(val: string | number): boolean;
|
|
322
|
+
declare const isFraction: (value: unknown) => boolean;
|
|
323
|
+
declare function isNumeric(v: unknown): boolean;
|
|
324
|
+
declare function allNumbers(arr: (number | string)[]): boolean;
|
|
325
|
+
declare const formatNumber: (number: number | string | undefined | null) => string;
|
|
326
|
+
declare function charCount(chr: string | number, str: string): number;
|
|
327
|
+
declare function getNumberOfDigitsToShow(num: number | string, maxNumDigits?: number): number;
|
|
328
|
+
declare function fraction(str: any): number | typeof Infinity | typeof NaN;
|
|
329
|
+
declare function asFraction(str: number | string): string;
|
|
330
|
+
declare function numFraction(str: any): any;
|
|
331
|
+
declare function cleanNumStr(str: string | number): string;
|
|
332
|
+
declare const stripLeadingZeros: (value: string) => string;
|
|
333
|
+
declare function cleanNum(str: string | number): number;
|
|
334
|
+
declare const isNonNumerical: (value: any) => boolean;
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/numbers/display-number.d.ts
|
|
337
|
+
type NumberDisplayOptions = {
|
|
338
|
+
scientific?: 'auto' | boolean;
|
|
339
|
+
eNotation?: boolean;
|
|
340
|
+
autoScientificBelow?: number;
|
|
341
|
+
autoScientificAbove?: number;
|
|
342
|
+
roundScientificCoefficient?: number;
|
|
343
|
+
withUnit?: boolean;
|
|
344
|
+
noThousandsSeparator?: boolean;
|
|
345
|
+
nonBreakingSpace?: boolean;
|
|
346
|
+
};
|
|
347
|
+
declare const displayNumber: <Value extends number | string | null | undefined>(value: Value, options?: NumberDisplayOptions) => string;
|
|
348
|
+
declare const displayNumberToFixed: <Value extends string | null | undefined>(value: Value, options?: NumberDisplayOptions) => string;
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/rounding/rounding.d.ts
|
|
351
|
+
declare const round: <Value extends number | string | null | undefined>(value: Value, n?: number) => Value;
|
|
352
|
+
declare const roundToPrecision: <Value extends number | string | null | undefined>(value: Value, n?: number) => Value;
|
|
353
|
+
declare const roundToDecimalPrecision: <Value extends number | string | null | undefined>(value: Value, n?: number) => Value;
|
|
354
|
+
declare const roundByMagnitude: <Value extends number | string | null | undefined>(value: Value, n?: number) => Value;
|
|
355
|
+
declare const roundByMagnitudeToFixed: <Value extends number | string | null | undefined>(value: Value, n?: number) => Value;
|
|
356
|
+
declare const roundByRange: <Value extends number | string | null | undefined>(value: Value, min: number, max: number, n?: number) => Value;
|
|
357
|
+
declare const roundToFixed: <Value extends number | string | null | undefined>(value: Value, n?: number) => Value;
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/comparison/comparison.d.ts
|
|
360
|
+
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
|
|
361
|
+
type XOR<T, U> = T | U extends Record<string, unknown> ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
|
362
|
+
type toleranceType = XOR<{
|
|
363
|
+
relativeDiff: number | string;
|
|
364
|
+
}, {
|
|
365
|
+
absoluteDiff: string | number;
|
|
366
|
+
}>;
|
|
367
|
+
declare const isCloseTo: (firstValue: number | string | null, secondValue: number | string | null, options?: toleranceType) => boolean;
|
|
368
|
+
declare const isCloseToOrGreaterThan: (firstValue: number | string | null, secondValue: number | string | null, options?: toleranceType) => boolean;
|
|
369
|
+
declare const isCloseToOrLessThan: (firstValue: number | string | null, secondValue: number | string | null, options?: toleranceType) => boolean;
|
|
370
|
+
declare const isDeepCloseTo: (a: any, b: any, options?: toleranceType) => boolean;
|
|
371
|
+
//#endregion
|
|
372
|
+
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 };
|
|
373
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/constants.ts","../src/utils.ts","../src/numbers/display-number.ts","../src/rounding/rounding.ts","../src/comparison/comparison.ts"],"mappings":"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"}
|