@oliasoft-open-source/units 4.3.0-beta-5 → 4.3.0-beta-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,74 +1,74 @@
1
1
  'use strict';
2
2
 
3
- var units = require('./units-8OgTPpkQ.cjs');
3
+ var numbers = require('./units-8OgTPpkQ.cjs');
4
4
  require('fraction.js');
5
5
 
6
6
 
7
7
 
8
- exports.ALT_UNITS = units.ALT_UNITS;
9
- exports.DEPRECATED_UNITS = units.DEPRECATED_UNITS;
10
- exports.INTERMEDIATE_CONVERSIONS = units.INTERMEDIATE_CONVERSIONS;
11
- exports.KNOWN_CONVERSIONS = units.KNOWN_CONVERSIONS;
12
- exports.KNOWN_UNITS = units.KNOWN_UNITS;
13
- exports.LABELS = units.LABELS;
14
- exports.QUANTITIES_DESCRIPTION = units.QUANTITIES_DESCRIPTION;
15
- exports.UNITS_DESCRIPTION = units.UNITS_DESCRIPTION;
16
- exports.UNIT_ALIASES = units.UNIT_ALIASES;
17
- exports.UNIT_FROM_KEY = units.UNIT_FROM_KEY;
18
- exports.allNumbers = units.allNumbers;
19
- exports.altUnitsList = units.altUnitsList;
20
- exports.asFraction = units.asFraction;
21
- exports.charCount = units.charCount;
22
- exports.checkAndCleanDecimalComma = units.checkAndCleanDecimalComma;
23
- exports.cleanNum = units.cleanNum;
24
- exports.cleanNumStr = units.cleanNumStr;
25
- exports.convertAndGetValue = units.convertAndGetValue;
26
- exports.convertAndGetValueStrict = units.convertAndGetValueStrict;
27
- exports.convertSamePrecision = units.convertSamePrecision;
28
- exports.convertTable = units.convertTable;
29
- exports.displayNumber = units.displayNumber;
30
- exports.displayNumberToFixed = units.displayNumberToFixed;
31
- exports.formatNumber = units.formatNumber;
32
- exports.fraction = units.fraction;
33
- exports.getAltUnitsListByQuantity = units.getAltUnitsListByQuantity;
34
- exports.getNumberOfDigitsToShow = units.getNumberOfDigitsToShow;
35
- exports.getQuantities = units.getQuantities;
36
- exports.getUnit = units.getUnit;
37
- exports.getUnitsForQuantity = units.getUnitsForQuantity;
38
- exports.getValue = units.getValue;
39
- exports.isCloseTo = units.isCloseTo;
40
- exports.isCloseToOrGreaterThan = units.isCloseToOrGreaterThan;
41
- exports.isCloseToOrLessThan = units.isCloseToOrLessThan;
42
- exports.isDeepCloseTo = units.isDeepCloseTo;
43
- exports.isEmptyValueWithUnit = units.isEmptyValueWithUnit;
44
- exports.isFraction = units.isFraction;
45
- exports.isNonNumerical = units.isNonNumerical;
46
- exports.isNumeric = units.isNumeric;
47
- exports.isScientificStringNum = units.isScientificStringNum;
48
- exports.isValidNum = units.isValidNum;
49
- exports.isValueWithUnit = units.isValueWithUnit;
50
- exports.label = units.label;
51
- exports.numFraction = units.numFraction;
52
- exports.round = units.round;
53
- exports.roundByMagnitude = units.roundByMagnitude;
54
- exports.roundByMagnitudeToFixed = units.roundByMagnitudeToFixed;
55
- exports.roundByRange = units.roundByRange;
56
- exports.roundNumberWithLabel = units.roundNumberWithLabel;
57
- exports.roundToDecimalPrecision = units.roundToDecimalPrecision;
58
- exports.roundToFixed = units.roundToFixed;
59
- exports.roundToPrecision = units.roundToPrecision;
60
- exports.showAltUnitsList = units.showAltUnitsList;
61
- exports.split = units.split;
62
- exports.stripLeadingZeros = units.stripLeadingZeros;
63
- exports.to = units.to;
64
- exports.toBase = units.toBase;
65
- exports.toNum = units.toNum;
66
- exports.toString = units.toString;
67
- exports.unitFromKey = units.unitFromKey;
68
- exports.unitFromQuantity = units.unitFromQuantity;
69
- exports.unum = units.unum;
70
- exports.unumWithUnit = units.unumWithUnit;
71
- exports.validateAndClean = units.validateAndClean;
72
- exports.validateNumber = units.validateNumber;
73
- exports.withPrettyUnitLabel = units.withPrettyUnitLabel;
74
- exports.withUnit = units.withUnit;
8
+ exports.ALT_UNITS = numbers.ALT_UNITS;
9
+ exports.DEPRECATED_UNITS = numbers.DEPRECATED_UNITS;
10
+ exports.INTERMEDIATE_CONVERSIONS = numbers.INTERMEDIATE_CONVERSIONS;
11
+ exports.KNOWN_CONVERSIONS = numbers.KNOWN_CONVERSIONS;
12
+ exports.KNOWN_UNITS = numbers.KNOWN_UNITS;
13
+ exports.LABELS = numbers.LABELS;
14
+ exports.QUANTITIES_DESCRIPTION = numbers.QUANTITIES_DESCRIPTION;
15
+ exports.UNITS_DESCRIPTION = numbers.UNITS_DESCRIPTION;
16
+ exports.UNIT_ALIASES = numbers.UNIT_ALIASES;
17
+ exports.UNIT_FROM_KEY = numbers.UNIT_FROM_KEY;
18
+ exports.allNumbers = numbers.allNumbers;
19
+ exports.altUnitsList = numbers.altUnitsList;
20
+ exports.asFraction = numbers.asFraction;
21
+ exports.charCount = numbers.charCount;
22
+ exports.checkAndCleanDecimalComma = numbers.checkAndCleanDecimalComma;
23
+ exports.cleanNum = numbers.cleanNum;
24
+ exports.cleanNumStr = numbers.cleanNumStr;
25
+ exports.convertAndGetValue = numbers.convertAndGetValue;
26
+ exports.convertAndGetValueStrict = numbers.convertAndGetValueStrict;
27
+ exports.convertSamePrecision = numbers.convertSamePrecision;
28
+ exports.convertTable = numbers.convertTable;
29
+ exports.displayNumber = numbers.displayNumber;
30
+ exports.displayNumberToFixed = numbers.displayNumberToFixed;
31
+ exports.formatNumber = numbers.formatNumber;
32
+ exports.fraction = numbers.fraction;
33
+ exports.getAltUnitsListByQuantity = numbers.getAltUnitsListByQuantity;
34
+ exports.getNumberOfDigitsToShow = numbers.getNumberOfDigitsToShow;
35
+ exports.getQuantities = numbers.getQuantities;
36
+ exports.getUnit = numbers.getUnit;
37
+ exports.getUnitsForQuantity = numbers.getUnitsForQuantity;
38
+ exports.getValue = numbers.getValue;
39
+ exports.isCloseTo = numbers.isCloseTo;
40
+ exports.isCloseToOrGreaterThan = numbers.isCloseToOrGreaterThan;
41
+ exports.isCloseToOrLessThan = numbers.isCloseToOrLessThan;
42
+ exports.isDeepCloseTo = numbers.isDeepCloseTo;
43
+ exports.isEmptyValueWithUnit = numbers.isEmptyValueWithUnit;
44
+ exports.isFraction = numbers.isFraction;
45
+ exports.isNonNumerical = numbers.isNonNumerical;
46
+ exports.isNumeric = numbers.isNumeric;
47
+ exports.isScientificStringNum = numbers.isScientificStringNum;
48
+ exports.isValidNum = numbers.isValidNum;
49
+ exports.isValueWithUnit = numbers.isValueWithUnit;
50
+ exports.label = numbers.label;
51
+ exports.numFraction = numbers.numFraction;
52
+ exports.round = numbers.round;
53
+ exports.roundByMagnitude = numbers.roundByMagnitude;
54
+ exports.roundByMagnitudeToFixed = numbers.roundByMagnitudeToFixed;
55
+ exports.roundByRange = numbers.roundByRange;
56
+ exports.roundNumberWithLabel = numbers.roundNumberWithLabel;
57
+ exports.roundToDecimalPrecision = numbers.roundToDecimalPrecision;
58
+ exports.roundToFixed = numbers.roundToFixed;
59
+ exports.roundToPrecision = numbers.roundToPrecision;
60
+ exports.showAltUnitsList = numbers.showAltUnitsList;
61
+ exports.split = numbers.split;
62
+ exports.stripLeadingZeros = numbers.stripLeadingZeros;
63
+ exports.to = numbers.to;
64
+ exports.toBase = numbers.toBase;
65
+ exports.toNum = numbers.toNum;
66
+ exports.toString = numbers.toString;
67
+ exports.unitFromKey = numbers.unitFromKey;
68
+ exports.unitFromQuantity = numbers.unitFromQuantity;
69
+ exports.unum = numbers.unum;
70
+ exports.unumWithUnit = numbers.unumWithUnit;
71
+ exports.validateAndClean = numbers.validateAndClean;
72
+ exports.validateNumber = numbers.validateNumber;
73
+ exports.withPrettyUnitLabel = numbers.withPrettyUnitLabel;
74
+ exports.withUnit = numbers.withUnit;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export { 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.js';
2
+ export { isScientificStringNum, isValidNum, toNum, toString } from './numbers/numbers.js';
3
+ import './interfaces.js';
2
4
 
3
5
  declare const LABELS: Record<string, string>;
4
6
  declare const ALT_UNITS: Record<string, string[]>;
@@ -322,11 +324,6 @@ declare const stripLeadingZeros: (value: string) => string;
322
324
  declare function cleanNum(str: string | number): number;
323
325
  declare const isNonNumerical: (value: any) => boolean;
324
326
 
325
- declare const isValidNum: (value: unknown) => boolean;
326
- declare const isScientificStringNum: (value: unknown) => boolean;
327
- declare const toNum: (value: unknown, fallback?: number, minimum?: number) => any;
328
- declare const toString: (value?: unknown) => unknown;
329
-
330
327
  type NumberDisplayOptions = {
331
328
  scientific?: 'auto' | boolean;
332
329
  eNotation?: boolean;
@@ -362,4 +359,4 @@ declare const isCloseToOrGreaterThan: (firstValue: number | string | null, secon
362
359
  declare const isCloseToOrLessThan: (firstValue: number | string | null, secondValue: number | string | null, options?: toleranceType) => boolean;
363
360
  declare const isDeepCloseTo: (a: any, b: any, options?: toleranceType) => boolean;
364
361
 
365
- export { ALT_UNITS, DEPRECATED_UNITS, INTERMEDIATE_CONVERSIONS, KNOWN_CONVERSIONS, KNOWN_UNITS, LABELS, QUANTITIES_DESCRIPTION, UNITS_DESCRIPTION, UNIT_ALIASES, UNIT_FROM_KEY, allNumbers, asFraction, charCount, cleanNum, cleanNumStr, displayNumber, displayNumberToFixed, formatNumber, fraction, getNumberOfDigitsToShow, isCloseTo, isCloseToOrGreaterThan, isCloseToOrLessThan, isDeepCloseTo, isEmptyValueWithUnit, isFraction, isNonNumerical, isNumeric, isScientificStringNum, isValidNum, numFraction, round, roundByMagnitude, roundByMagnitudeToFixed, roundByRange, roundToDecimalPrecision, roundToFixed, roundToPrecision, stripLeadingZeros, toNum, toString };
362
+ export { ALT_UNITS, DEPRECATED_UNITS, INTERMEDIATE_CONVERSIONS, KNOWN_CONVERSIONS, KNOWN_UNITS, LABELS, QUANTITIES_DESCRIPTION, UNITS_DESCRIPTION, UNIT_ALIASES, UNIT_FROM_KEY, allNumbers, asFraction, charCount, cleanNum, cleanNumStr, displayNumber, displayNumberToFixed, formatNumber, fraction, getNumberOfDigitsToShow, isCloseTo, isCloseToOrGreaterThan, isCloseToOrLessThan, isDeepCloseTo, isEmptyValueWithUnit, isFraction, isNonNumerical, isNumeric, numFraction, round, roundByMagnitude, roundByMagnitudeToFixed, roundByRange, roundToDecimalPrecision, roundToFixed, roundToPrecision, stripLeadingZeros };
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,15 @@
1
+ interface AltUnitWithLabel {
2
+ unit: string | never;
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 };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ var numbers = require('../units-8OgTPpkQ.cjs');
4
+ require('fraction.js');
5
+
6
+
7
+
8
+ exports.isScientificStringNum = numbers.isScientificStringNum;
9
+ exports.isValidNum = numbers.isValidNum;
10
+ exports.toNum = numbers.toNum;
11
+ exports.toString = numbers.toString;
@@ -0,0 +1,6 @@
1
+ declare const isValidNum: (value: unknown) => boolean;
2
+ declare const isScientificStringNum: (value: unknown) => boolean;
3
+ declare const toNum: (value: unknown, fallback?: number, minimum?: number) => any;
4
+ declare const toString: (value?: unknown) => unknown;
5
+
6
+ export { isScientificStringNum, isValidNum, toNum, toString };
@@ -0,0 +1,2 @@
1
+ export { a1 as isScientificStringNum, a0 as isValidNum, _ as toNum, $ as toString } from '../units-eowpZ327.js';
2
+ import 'fraction.js';
package/dist/units.cjs CHANGED
@@ -1,35 +1,35 @@
1
1
  'use strict';
2
2
 
3
- var units = require('./units-8OgTPpkQ.cjs');
3
+ var numbers = require('./units-8OgTPpkQ.cjs');
4
4
  require('fraction.js');
5
5
 
6
6
 
7
7
 
8
- exports.EXP_NOTATION_RE = units.EXP_NOTATION_RE;
9
- exports.SEPARATOR = units.SEPARATOR;
10
- exports.altUnitsList = units.altUnitsList;
11
- exports.checkAndCleanDecimalComma = units.checkAndCleanDecimalComma;
12
- exports.convertAndGetValue = units.convertAndGetValue;
13
- exports.convertAndGetValueStrict = units.convertAndGetValueStrict;
14
- exports.convertSamePrecision = units.convertSamePrecision;
15
- exports.convertTable = units.convertTable;
16
- exports.getAltUnitsListByQuantity = units.getAltUnitsListByQuantity;
17
- exports.getQuantities = units.getQuantities;
18
- exports.getUnit = units.getUnit;
19
- exports.getUnitsForQuantity = units.getUnitsForQuantity;
20
- exports.getValue = units.getValue;
21
- exports.isValueWithUnit = units.isValueWithUnit;
22
- exports.label = units.label;
23
- exports.roundNumberWithLabel = units.roundNumberWithLabel;
24
- exports.showAltUnitsList = units.showAltUnitsList;
25
- exports.split = units.split;
26
- exports.to = units.to;
27
- exports.toBase = units.toBase;
28
- exports.unitFromKey = units.unitFromKey;
29
- exports.unitFromQuantity = units.unitFromQuantity;
30
- exports.unum = units.unum;
31
- exports.unumWithUnit = units.unumWithUnit;
32
- exports.validateAndClean = units.validateAndClean;
33
- exports.validateNumber = units.validateNumber;
34
- exports.withPrettyUnitLabel = units.withPrettyUnitLabel;
35
- exports.withUnit = units.withUnit;
8
+ exports.EXP_NOTATION_RE = numbers.EXP_NOTATION_RE;
9
+ exports.SEPARATOR = numbers.SEPARATOR;
10
+ exports.altUnitsList = numbers.altUnitsList;
11
+ exports.checkAndCleanDecimalComma = numbers.checkAndCleanDecimalComma;
12
+ exports.convertAndGetValue = numbers.convertAndGetValue;
13
+ exports.convertAndGetValueStrict = numbers.convertAndGetValueStrict;
14
+ exports.convertSamePrecision = numbers.convertSamePrecision;
15
+ exports.convertTable = numbers.convertTable;
16
+ exports.getAltUnitsListByQuantity = numbers.getAltUnitsListByQuantity;
17
+ exports.getQuantities = numbers.getQuantities;
18
+ exports.getUnit = numbers.getUnit;
19
+ exports.getUnitsForQuantity = numbers.getUnitsForQuantity;
20
+ exports.getValue = numbers.getValue;
21
+ exports.isValueWithUnit = numbers.isValueWithUnit;
22
+ exports.label = numbers.label;
23
+ exports.roundNumberWithLabel = numbers.roundNumberWithLabel;
24
+ exports.showAltUnitsList = numbers.showAltUnitsList;
25
+ exports.split = numbers.split;
26
+ exports.to = numbers.to;
27
+ exports.toBase = numbers.toBase;
28
+ exports.unitFromKey = numbers.unitFromKey;
29
+ exports.unitFromQuantity = numbers.unitFromQuantity;
30
+ exports.unum = numbers.unum;
31
+ exports.unumWithUnit = numbers.unumWithUnit;
32
+ exports.validateAndClean = numbers.validateAndClean;
33
+ exports.validateNumber = numbers.validateNumber;
34
+ exports.withPrettyUnitLabel = numbers.withPrettyUnitLabel;
35
+ exports.withUnit = numbers.withUnit;
package/dist/units.d.ts CHANGED
@@ -1,11 +1,4 @@
1
- interface AltUnitWithLabel {
2
- unit: string | never;
3
- label: string | undefined;
4
- }
5
- interface ValidateReturn {
6
- valid: boolean;
7
- errors: (string | undefined)[] | undefined;
8
- }
1
+ import { AltUnitWithLabel, ValidateReturn } from './interfaces.js';
9
2
 
10
3
  declare const SEPARATOR = "|";
11
4
  declare const EXP_NOTATION_RE: RegExp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/units",
3
- "version": "4.3.0-beta-5",
3
+ "version": "4.3.0-beta-6",
4
4
  "description": "Package for units management",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -16,6 +16,16 @@
16
16
  "import": "./dist/units.js",
17
17
  "require": "./dist/units.cjs",
18
18
  "types": "./dist/units.d.ts"
19
+ },
20
+ "./dist/numbers/numbers": {
21
+ "import": "./dist/numbers/numbers.js",
22
+ "require": "./dist/numbers/numbers.cjs",
23
+ "types": "./dist/numbers/numbers.d.ts"
24
+ },
25
+ "./dist/interfaces": {
26
+ "import": "./dist/interfaces.js",
27
+ "require": "./dist/interfaces.cjs",
28
+ "types": "./dist/interfaces.d.ts"
19
29
  }
20
30
  },
21
31
  "files": [