@oliasoft-open-source/units 4.5.2-beta-1 → 4.5.2

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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var numbers = require('./units-CJ3ckQN8.cjs');
3
+ var numbers = require('./units-DrwQLYMh.cjs');
4
4
  require('fraction.js');
5
5
 
6
6
 
package/dist/index.d.ts CHANGED
@@ -355,7 +355,7 @@ declare const roundToFixed: <Value extends number | string | null | undefined>(v
355
355
  type Without<T, U> = {
356
356
  [P in Exclude<keyof T, keyof U>]?: never;
357
357
  };
358
- type XOR<T, U> = (T | U) extends Record<string, unknown> ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
358
+ type XOR<T, U> = T | U extends Record<string, unknown> ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
359
359
  type toleranceType = XOR<{
360
360
  relativeDiff: number | string;
361
361
  }, {
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { a3 as ALT_UNITS, a7 as DEPRECATED_UNITS, a9 as INTERMEDIATE_CONVERSIONS, a6 as KNOWN_CONVERSIONS, aa as KNOWN_UNITS, a4 as LABELS, ab as QUANTITIES_DESCRIPTION, ac as UNITS_DESCRIPTION, a8 as UNIT_ALIASES, a5 as UNIT_FROM_KEY, O as allNumbers, i as altUnitsList, W as asFraction, S as charCount, c as checkAndCleanDecimalComma, Z as cleanNum, Y as cleanNumStr, q as convertAndGetValue, x as convertAndGetValueStrict, p as convertSamePrecision, j as convertTable, Q as displayNumber, R as displayNumberToFixed, P as formatNumber, U as fraction, g as getAltUnitsListByQuantity, T as getNumberOfDigitsToShow, b as getQuantities, o as getUnit, a as getUnitsForQuantity, n as getValue, H as isCloseTo, K as isCloseToOrGreaterThan, J as isCloseToOrLessThan, I as isDeepCloseTo, N as isEmptyValueWithUnit, V as isFraction, M as isNonNumerical, L as isNumeric, a1 as isScientificStringNum, a0 as isValidNum, m as isValueWithUnit, l as label, X as numFraction, A as round, E as roundByMagnitude, F as roundByMagnitudeToFixed, G as roundByRange, r as roundNumberWithLabel, D as roundToDecimalPrecision, B as roundToFixed, C as roundToPrecision, s as showAltUnitsList, e as split, a2 as stripLeadingZeros, t as to, h as toBase, _ as toNum, $ as toString, u as unitFromKey, d as unitFromQuantity, f as unum, k as unumWithUnit, v as validateAndClean, z as validateNumber, y as withPrettyUnitLabel, w as withUnit } from './units-CrmXBjNL.js';
1
+ export { a3 as ALT_UNITS, a7 as DEPRECATED_UNITS, a9 as INTERMEDIATE_CONVERSIONS, a6 as KNOWN_CONVERSIONS, aa as KNOWN_UNITS, a4 as LABELS, ab as QUANTITIES_DESCRIPTION, ac as UNITS_DESCRIPTION, a8 as UNIT_ALIASES, a5 as UNIT_FROM_KEY, O as allNumbers, i as altUnitsList, W as asFraction, S as charCount, c as checkAndCleanDecimalComma, Z as cleanNum, Y as cleanNumStr, q as convertAndGetValue, x as convertAndGetValueStrict, p as convertSamePrecision, j as convertTable, Q as displayNumber, R as displayNumberToFixed, P as formatNumber, U as fraction, g as getAltUnitsListByQuantity, T as getNumberOfDigitsToShow, b as getQuantities, o as getUnit, a as getUnitsForQuantity, n as getValue, H as isCloseTo, K as isCloseToOrGreaterThan, J as isCloseToOrLessThan, I as isDeepCloseTo, N as isEmptyValueWithUnit, V as isFraction, M as isNonNumerical, L as isNumeric, a1 as isScientificStringNum, a0 as isValidNum, m as isValueWithUnit, l as label, X as numFraction, A as round, E as roundByMagnitude, F as roundByMagnitudeToFixed, G as roundByRange, r as roundNumberWithLabel, D as roundToDecimalPrecision, B as roundToFixed, C as roundToPrecision, s as showAltUnitsList, e as split, a2 as stripLeadingZeros, t as to, h as toBase, _ as toNum, $ as toString, u as unitFromKey, d as unitFromQuantity, f as unum, k as unumWithUnit, v as validateAndClean, z as validateNumber, y as withPrettyUnitLabel, w as withUnit } from './units-DKcliZbm.js';
2
2
  import 'fraction.js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var numbers = require('../units-CJ3ckQN8.cjs');
3
+ var numbers = require('../units-DrwQLYMh.cjs');
4
4
  require('fraction.js');
5
5
 
6
6
 
@@ -1,2 +1,2 @@
1
- export { a1 as isScientificStringNum, a0 as isValidNum, _ as toNum, $ as toString } from '../units-CrmXBjNL.js';
1
+ export { a1 as isScientificStringNum, a0 as isValidNum, _ as toNum, $ as toString } from '../units-DKcliZbm.js';
2
2
  import 'fraction.js';
@@ -155,14 +155,18 @@ const isCloseTo = (firstValue, secondValue, options = { relativeDiff: DEFAULT_MA
155
155
  const hasUnitFirstValue = isValueWithUnit(firstValue);
156
156
  const hasUnitSecondValue = isValueWithUnit(secondValue);
157
157
  if (hasUnitFirstValue && !hasUnitSecondValue || !hasUnitFirstValue && hasUnitSecondValue) {
158
- throw new Error(`Parameters must either both have units or both not have units. Received "${firstValue}" and "${secondValue}"`);
158
+ throw new Error(
159
+ `Parameters must either both have units or both not have units. Received "${firstValue}" and "${secondValue}"`
160
+ );
159
161
  }
160
162
  if (toleranceNumber === null) {
161
163
  console.warn("Tolerance number is not defined!");
162
164
  return firstValue === secondValue;
163
165
  }
164
166
  if (toleranceNumber <= 0 || toleranceNumber < Number.EPSILON) {
165
- throw Error("Unpredictable results - toleranceNumber should be bigger than zero or less then EPSILON");
167
+ throw Error(
168
+ "Unpredictable results - toleranceNumber should be bigger than zero or less then EPSILON"
169
+ );
166
170
  }
167
171
  const { firstNumber, secondNumber } = convertNumbers(firstValue, secondValue);
168
172
  if ((firstNumber === Infinity || firstNumber === "Infinity") && (secondNumber === Infinity || secondNumber === "Infinity") || (firstNumber === -Infinity || firstNumber === "-Infinity") && (secondNumber === -Infinity || secondNumber === "-Infinity")) {
@@ -174,7 +178,9 @@ const isCloseTo = (firstValue, secondValue, options = { relativeDiff: DEFAULT_MA
174
178
  const diff2 = Math.abs(firstNumber - secondNumber);
175
179
  return isCloseTo(diff2, toleranceNumber, { relativeDiff: "1%" }) || diff2 < toleranceNumber;
176
180
  } else {
177
- return 2 * Math.abs((firstNumber - secondNumber) / (firstNumber + secondNumber)) < toleranceNumber;
181
+ return 2 * Math.abs(
182
+ (firstNumber - secondNumber) / (firstNumber + secondNumber)
183
+ ) < toleranceNumber;
178
184
  }
179
185
  }
180
186
  return false;
@@ -303,7 +309,11 @@ const roundToDecimalPrecision = (value, n = DEFAULT_SIGNIFICANT_DIGITS) => {
303
309
  };
304
310
  const roundNumberByMagnitude = (value, n = DEFAULT_SIGNIFICANT_DIGITS, toFixed = false) => {
305
311
  const noDecimalsAbove = 10 ** n;
306
- const result = noDecimalsAbove && value > noDecimalsAbove ? roundNumber(value, 0) : toFixed ? roundNumberToFixedPrecision(value, n) : roundNumberToPrecision(value, n);
312
+ const result = noDecimalsAbove && value > noDecimalsAbove ? roundNumber(value, 0) : toFixed ? roundNumberToFixedPrecision(value, n) : (
313
+ //for comparison, old implementation from toPretty (functionally equivalent to new implementation, see tests)
314
+ //return Number(value.toExponential(n - 1).toString());
315
+ roundNumberToPrecision(value, n)
316
+ );
307
317
  return toFixed ? String(result) : result;
308
318
  };
309
319
  const roundByMagnitude = (value, n = DEFAULT_SIGNIFICANT_DIGITS) => {
@@ -402,11 +412,11 @@ const appendTrailingZeros = (value, numberOfZeros) => {
402
412
  return numberOfZeros > 0 && value !== "0" ? !value.includes(".") ? `${value}.${zeros}` : `${value}${zeros}` : value;
403
413
  };
404
414
  const formatDecimal = (value, thousandSeparator, preserveTrailingZeros = false) => {
405
- const convertedValue = convertNumberToLocale(toNum(value), "en-US").replaceAll(",", thousandSeparator);
406
- return preserveTrailingZeros ? appendTrailingZeros(
407
- convertedValue,
408
- countTrailingZeros(value, true)
409
- ) : convertedValue;
415
+ const convertedValue = convertNumberToLocale(
416
+ toNum(value),
417
+ "en-US"
418
+ ).replaceAll(",", thousandSeparator);
419
+ return preserveTrailingZeros ? appendTrailingZeros(convertedValue, countTrailingZeros(value, true)) : convertedValue;
410
420
  };
411
421
  const formatDecimalDisplayNumber = (value, options) => {
412
422
  const { nonBreakingSpace } = options ?? {};
@@ -423,10 +433,7 @@ const formatDecimalDisplayNumber = (value, options) => {
423
433
  return formatDecimal(value, space, options?.preserveTrailingZeros);
424
434
  };
425
435
  const formatScientificDisplayNumber = (value, options) => {
426
- const {
427
- roundScientificCoefficient,
428
- eNotation
429
- } = options ?? {};
436
+ const { roundScientificCoefficient, eNotation } = options ?? {};
430
437
  if (Number.isNaN(value)) {
431
438
  return "Invalid";
432
439
  }
@@ -665,8 +672,8 @@ function cleanNumStr(str) {
665
672
  }
666
673
  const stripLeadingZeros = (value) => {
667
674
  const isMinus = value?.[0] === "-";
668
- const matchMinus = /^-/mg;
669
- const matchLeadingZeros = /^(?:0+(?=[1-9])|0+(?=0))/mg;
675
+ const matchMinus = /^-/gm;
676
+ const matchLeadingZeros = /^(?:0+(?=[1-9])|0+(?=0))/gm;
670
677
  const cleanedValue = value.replace(matchMinus, "").replace(matchLeadingZeros, "");
671
678
  return isMinus ? `-${cleanedValue}` : cleanedValue;
672
679
  };
@@ -696,7 +703,9 @@ function newton(f, df, x0, tol = 1e-8, max_iter = 30) {
696
703
  }
697
704
  function erf(z) {
698
705
  const t = 1 / (1 + 0.5 * abs(z));
699
- const ans = 1 - t * exp(-(z ** 2) - 1.26551223 + t * (1.00002368 + t * (0.37409196 + t * (0.09678418 + t * (-0.18628806 + t * (0.27886807 + t * (-1.13520398 + t * (1.48851587 + t * (-0.82215223 + t * 0.17087277)))))))));
706
+ const ans = 1 - t * exp(
707
+ -(z ** 2) - 1.26551223 + t * (1.00002368 + t * (0.37409196 + t * (0.09678418 + t * (-0.18628806 + t * (0.27886807 + t * (-1.13520398 + t * (1.48851587 + t * (-0.82215223 + t * 0.17087277))))))))
708
+ );
700
709
  return z >= 0 ? ans : -ans;
701
710
  }
702
711
  function get_k_from_conf_int(a) {
@@ -727,7 +736,9 @@ function normalizeScientific(val) {
727
736
  const fixedLeft = normalizeExponent(val2.trim());
728
737
  return `${fixedLeft}|${unit.trim()}`;
729
738
  }
730
- const m = s.match(/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)\s*[eE]\s*[+-]?\s*\d+)\s+(.+)$/);
739
+ const m = s.match(
740
+ /^([+-]?(?:\d+(?:\.\d*)?|\.\d+)\s*[eE]\s*[+-]?\s*\d+)\s+(.+)$/
741
+ );
731
742
  if (m) return `${normalizeExponent(m[1])}|${m[2].trim()}`;
732
743
  return normalizeExponent(s);
733
744
  }
@@ -880,9 +891,9 @@ const LABELS = Object.freeze({
880
891
  mph: "mph",
881
892
  "km/h": "km/h",
882
893
  "m/s2": "m/s\xB2",
883
- "Gs": "Gs",
884
- "nT": "nT",
885
- "g": "g",
894
+ Gs: "Gs",
895
+ nT: "nT",
896
+ g: "g",
886
897
  "ft/s2": "ft/s\xB2",
887
898
  "Pa*s": "Pa\u22C5s",
888
899
  P: "P",
@@ -950,7 +961,15 @@ const LABELS = Object.freeze({
950
961
  });
951
962
  const ALT_UNITS = Object.freeze({
952
963
  acceleration: ["ft/s2", "m/s2"],
953
- angleGradient: ["deg/30m", "rad/m", "deg/m", "deg/ft", "rad/ft", "deg/100ft", "deg/10m"],
964
+ angleGradient: [
965
+ "deg/30m",
966
+ "rad/m",
967
+ "deg/m",
968
+ "deg/ft",
969
+ "rad/ft",
970
+ "deg/100ft",
971
+ "deg/10m"
972
+ ],
954
973
  angles: ["deg", "rad"],
955
974
  areaOther: ["in2", "ft2", "mm2", "cm2", "m2", "mile2", "km2"],
956
975
  areaTubular: ["in2", "cm2", "ft2", "m2"],
@@ -1023,23 +1042,36 @@ const ALT_UNITS = Object.freeze({
1023
1042
  permeability: ["mD", "m2"],
1024
1043
  power: ["hp", "W", "hhp", "MW", "kW", "BTU/h"],
1025
1044
  pressure: ["bar", "psi", "Pa", "kPa", "MPa", "ksi", "GPa", "lbf/100ft2"],
1026
- pressureGradient: ["bar/100m", "Pa/m", "bar/m", "psi/100ft", "psi/ft", "kPa/m"],
1045
+ pressureGradient: [
1046
+ "bar/100m",
1047
+ "Pa/m",
1048
+ "bar/m",
1049
+ "psi/100ft",
1050
+ "psi/ft",
1051
+ "kPa/m"
1052
+ ],
1027
1053
  pressurechange: ["bar", "psi", "Pa", "MPa", "kPa"],
1028
1054
  gasliftFlowRate: ["STB/d", "Sm3/d", "SCF/d"],
1029
1055
  productionFlowRate: ["MMSCFD", "STB/d", "Sm3/d", "MSm3/d", "SCF/d"],
1030
1056
  productionFlowRateOil: ["MMSCFD", "STB/d", "Sm3/d", "MSm3/d", "SCF/d"],
1031
1057
  productionFlowRateGas: ["MMSCFD", "STB/d", "Sm3/d", "MSm3/d", "SCF/d"],
1032
- injectionFlowRate: ["lpm", "lps", "bpm", "gpm", "MMSCFD", "STB/d", "Sm3/d", "MSm3/d", "SCF/d"],
1058
+ injectionFlowRate: [
1059
+ "lpm",
1060
+ "lps",
1061
+ "bpm",
1062
+ "gpm",
1063
+ "MMSCFD",
1064
+ "STB/d",
1065
+ "Sm3/d",
1066
+ "MSm3/d",
1067
+ "SCF/d"
1068
+ ],
1033
1069
  pumpRate: ["lpm", "lps", "bpm", "m3/s", "ft3/s", "gpm"],
1034
1070
  rotationalSpeed: ["rpm", "Hz"],
1035
1071
  roughness: ["m", "microM", "in"],
1036
1072
  rpm: ["rpm", "Hz"],
1037
1073
  sdstats: ["CI", "Sigma"],
1038
- specificHeatCapacity: [
1039
- "J/(kg*degC)",
1040
- "J/(kg*degK)",
1041
- "BTU/(lbm*degF)"
1042
- ],
1074
+ specificHeatCapacity: ["J/(kg*degC)", "J/(kg*degK)", "BTU/(lbm*degF)"],
1043
1075
  speed: ["km/h", "ft/min", "mph", "ft/h", "ft/s", "m/min", "m/s", "m/h"],
1044
1076
  inverseStandSpeed: ["d/stand", "h/stand", "min/stand", "s/stand"],
1045
1077
  rop: ["ft/h", "ft/min", "ft/s", "km/h", "m/h", "m/min", "m/s", "mph"],
@@ -1047,10 +1079,7 @@ const ALT_UNITS = Object.freeze({
1047
1079
  temperature: ["C", "F", "K"],
1048
1080
  pressurePerTemperature: ["Pa/C", "Bar/C", "psi/F", "psi/C"],
1049
1081
  tempgrad: ["C/100m", "F/100ft", "K/100m", "C/m", "F/ft", "K/m"],
1050
- thermalConductivity: [
1051
- "BTU/(h*ft*degF)",
1052
- "W/(mK)"
1053
- ],
1082
+ thermalConductivity: ["BTU/(h*ft*degF)", "W/(mK)"],
1054
1083
  thermalExpansionCoefficient: ["E-06/degC", "E-06/degF", "1/K"],
1055
1084
  torque: ["Nm", "ftlbf", "kNm"],
1056
1085
  torqueGradient: ["N", "lbf", "tonnes"],
@@ -1070,15 +1099,7 @@ const ALT_UNITS = Object.freeze({
1070
1099
  "MSm3",
1071
1100
  "SCF"
1072
1101
  ],
1073
- kickToleranceVolume: [
1074
- "m3",
1075
- "bbl",
1076
- "USGal",
1077
- "ft3",
1078
- "STB",
1079
- "Sm3",
1080
- "SCF"
1081
- ],
1102
+ kickToleranceVolume: ["m3", "bbl", "USGal", "ft3", "STB", "Sm3", "SCF"],
1082
1103
  weight: ["tonnes", "kg", "lbf", "mt", "kip", "N"],
1083
1104
  weightGradient: ["ppf", "kg/m"],
1084
1105
  wgrad: ["sg", "ppg"],
@@ -1090,7 +1111,20 @@ const ALT_UNITS = Object.freeze({
1090
1111
  shearStress: ["Pa", "lbf/100ft2"],
1091
1112
  sensorAccelerometer: ["g", "m/s2"],
1092
1113
  sensorMagnetometer: ["nT", "Gs"],
1093
- location: ["lk", "ftCla", "lkCla", "ftSe", "ydSe", "chSe", "chSe(T)", "ftGC", "ydInd", "ft", "m", "usft"],
1114
+ location: [
1115
+ "lk",
1116
+ "ftCla",
1117
+ "lkCla",
1118
+ "ftSe",
1119
+ "ydSe",
1120
+ "chSe",
1121
+ "chSe(T)",
1122
+ "ftGC",
1123
+ "ydInd",
1124
+ "ft",
1125
+ "m",
1126
+ "usft"
1127
+ ],
1094
1128
  mixingRequirements: ["m3/t", "L/100kg"],
1095
1129
  entalphy: ["J/kg", "kJ/kg", "BTU/lbm"]
1096
1130
  });
@@ -1321,8 +1355,8 @@ const KNOWN_CONVERSIONS = Object.freeze({
1321
1355
  "kg|tonnes": (val) => val / 1e3,
1322
1356
  "kg|mt": (val) => val / 1e3,
1323
1357
  /*
1324
- 1 kip = 1000 lbf - https://en.wikipedia.org/wiki/Kip_(unit)
1325
- */
1358
+ 1 kip = 1000 lbf - https://en.wikipedia.org/wiki/Kip_(unit)
1359
+ */
1326
1360
  "kg|kip": (val) => val * C.kg_to_lbf * 1e-3,
1327
1361
  "kgf|kg": (val) => val,
1328
1362
  "lbf|kg": (val) => val * C.lbf_to_kg,
@@ -1410,9 +1444,9 @@ const KNOWN_CONVERSIONS = Object.freeze({
1410
1444
  "Mm3/d|m3/d": (val) => val * 1e6,
1411
1445
  "m3/d|Mm3/d": (val) => val * 1e-6,
1412
1446
  /*
1413
- exact formula is 247854343 / 134687500000000 = 0.0000018402178598607888 - https://www.wolframalpha.com/input?i=STB%2Fd
1414
- STB has a lot of intermediate conversions, so to avoid delta during conversions trip we have to store 2 more digits
1415
- */
1447
+ exact formula is 247854343 / 134687500000000 = 0.0000018402178598607888 - https://www.wolframalpha.com/input?i=STB%2Fd
1448
+ STB has a lot of intermediate conversions, so to avoid delta during conversions trip we have to store 2 more digits
1449
+ */
1416
1450
  "STB/d|m3/s": (val) => val * 184021785986e-17,
1417
1451
  "Sm3/d|m3/d": (val) => val,
1418
1452
  // At a pressure of 101.325 kPa (760 Torr) and DIN 1343: a temperature of 273.15 K (0°C/32°F) | NOTE: Thomas suggested that we leep those conversions 1to1,
@@ -1878,9 +1912,13 @@ const INTERMEDIATE_CONVERSIONS = Object.freeze({
1878
1912
  //Entalphy
1879
1913
  "BTU/lbm": "J/kg"
1880
1914
  });
1881
- const KNOWN_UNITS = Object.freeze(Array.from(new Set(Object.values(ALT_UNITS).flat())));
1915
+ const KNOWN_UNITS = Object.freeze(
1916
+ Array.from(new Set(Object.values(ALT_UNITS).flat()))
1917
+ );
1882
1918
  const SPECIAL_NUMBERS = [NaN, -Infinity, Infinity];
1883
- const SPECIAL_NUMBERS_STRING = SPECIAL_NUMBERS.map((number) => number.toString());
1919
+ const SPECIAL_NUMBERS_STRING = SPECIAL_NUMBERS.map(
1920
+ (number) => number.toString()
1921
+ );
1884
1922
  const QUANTITIES_DESCRIPTION = {
1885
1923
  density: "Density",
1886
1924
  length: "Length",
@@ -2404,7 +2442,9 @@ function unum(numWithUnit, toUnit, fromUnit) {
2404
2442
  if (m[0] == null) m[0] = "0";
2405
2443
  if (m[1]) fromUnit = m[1];
2406
2444
  if (!fromUnit && toUnit !== fromUnit) {
2407
- throw new Error(`unum: unable to figure out unit: ${numWithUnit} fromUnit ${fromUnit}`);
2445
+ throw new Error(
2446
+ `unum: unable to figure out unit: ${numWithUnit} fromUnit ${fromUnit}`
2447
+ );
2408
2448
  }
2409
2449
  if (toUnit === fromUnit) {
2410
2450
  const v = m[0] ? toNum(m[0]) : 0;
@@ -2473,10 +2513,7 @@ function convertTable(toUnitRow, table, defaultUnitRow, removeFinalUnitsRow = fa
2473
2513
  return newTable;
2474
2514
  }
2475
2515
  function roundNumberWithLabel(value, n = 2) {
2476
- return displayNumber(
2477
- round(value, n),
2478
- { withUnit: true }
2479
- );
2516
+ return displayNumber(round(value, n), { withUnit: true });
2480
2517
  }
2481
2518
  function withUnit(value, unit, defaultVal = "") {
2482
2519
  if (value === null || value === "" || value === void 0) {
@@ -2524,7 +2561,10 @@ function convertSamePrecision(numWithUnit, toUnit, digits) {
2524
2561
  let j = prettyNumber.length;
2525
2562
  if (prettyNumber[--j] == "0") {
2526
2563
  while (prettyNumber[--j] == "0") ;
2527
- prettyNumber = prettyNumber.slice(0, j + (prettyNumber[j] == "." ? 0 : 1));
2564
+ prettyNumber = prettyNumber.slice(
2565
+ 0,
2566
+ j + (prettyNumber[j] == "." ? 0 : 1)
2567
+ );
2528
2568
  }
2529
2569
  }
2530
2570
  }
@@ -2536,7 +2576,10 @@ function altUnitsList(value, quantity) {
2536
2576
  v = withUnit(value, unitFromQuantity(quantity) ?? "");
2537
2577
  }
2538
2578
  const altUnits = ALT_UNITS[quantity] ?? [];
2539
- return altUnits.map((unit) => [...split(convertSamePrecision(v, unit)), label(unit)]);
2579
+ return altUnits.map((unit) => [
2580
+ ...split(convertSamePrecision(v, unit)),
2581
+ label(unit)
2582
+ ]);
2540
2583
  }
2541
2584
  function validateAndClean(previousValue, nextText) {
2542
2585
  const unit = split(previousValue)[1];
@@ -2547,7 +2590,10 @@ function validateAndClean(previousValue, nextText) {
2547
2590
  const stripDot = /^([^.]*\.)|\./g;
2548
2591
  const stripDotFollowedByE = /\.(?=e)/g;
2549
2592
  const stripMinus = /-|[eE]-/g;
2550
- const cleanedValue = nextText.replace(stripAllExceptNumeric, "").replace(stripE, "$1").replace(stripInvalidLeading, "").replace(replaceComma, ".").replace(stripDot, "$1").replace(stripDotFollowedByE, "").replace(stripMinus, (match, offset) => offset === 0 || match.toLowerCase() === "e-" ? match : "");
2593
+ const cleanedValue = nextText.replace(stripAllExceptNumeric, "").replace(stripE, "$1").replace(stripInvalidLeading, "").replace(replaceComma, ".").replace(stripDot, "$1").replace(stripDotFollowedByE, "").replace(
2594
+ stripMinus,
2595
+ (match, offset) => offset === 0 || match.toLowerCase() === "e-" ? match : ""
2596
+ );
2551
2597
  return !Number.isFinite(+cleanedValue) ? previousValue : `${cleanedValue}${unit ? "|" : ""}${unit}`;
2552
2598
  }
2553
2599
  function withPrettyUnitLabel(valueWithUnits) {
@@ -157,14 +157,18 @@ const isCloseTo = (firstValue, secondValue, options = { relativeDiff: DEFAULT_MA
157
157
  const hasUnitFirstValue = isValueWithUnit(firstValue);
158
158
  const hasUnitSecondValue = isValueWithUnit(secondValue);
159
159
  if (hasUnitFirstValue && !hasUnitSecondValue || !hasUnitFirstValue && hasUnitSecondValue) {
160
- throw new Error(`Parameters must either both have units or both not have units. Received "${firstValue}" and "${secondValue}"`);
160
+ throw new Error(
161
+ `Parameters must either both have units or both not have units. Received "${firstValue}" and "${secondValue}"`
162
+ );
161
163
  }
162
164
  if (toleranceNumber === null) {
163
165
  console.warn("Tolerance number is not defined!");
164
166
  return firstValue === secondValue;
165
167
  }
166
168
  if (toleranceNumber <= 0 || toleranceNumber < Number.EPSILON) {
167
- throw Error("Unpredictable results - toleranceNumber should be bigger than zero or less then EPSILON");
169
+ throw Error(
170
+ "Unpredictable results - toleranceNumber should be bigger than zero or less then EPSILON"
171
+ );
168
172
  }
169
173
  const { firstNumber, secondNumber } = convertNumbers(firstValue, secondValue);
170
174
  if ((firstNumber === Infinity || firstNumber === "Infinity") && (secondNumber === Infinity || secondNumber === "Infinity") || (firstNumber === -Infinity || firstNumber === "-Infinity") && (secondNumber === -Infinity || secondNumber === "-Infinity")) {
@@ -176,7 +180,9 @@ const isCloseTo = (firstValue, secondValue, options = { relativeDiff: DEFAULT_MA
176
180
  const diff2 = Math.abs(firstNumber - secondNumber);
177
181
  return isCloseTo(diff2, toleranceNumber, { relativeDiff: "1%" }) || diff2 < toleranceNumber;
178
182
  } else {
179
- return 2 * Math.abs((firstNumber - secondNumber) / (firstNumber + secondNumber)) < toleranceNumber;
183
+ return 2 * Math.abs(
184
+ (firstNumber - secondNumber) / (firstNumber + secondNumber)
185
+ ) < toleranceNumber;
180
186
  }
181
187
  }
182
188
  return false;
@@ -305,7 +311,11 @@ const roundToDecimalPrecision = (value, n = DEFAULT_SIGNIFICANT_DIGITS) => {
305
311
  };
306
312
  const roundNumberByMagnitude = (value, n = DEFAULT_SIGNIFICANT_DIGITS, toFixed = false) => {
307
313
  const noDecimalsAbove = 10 ** n;
308
- const result = noDecimalsAbove && value > noDecimalsAbove ? roundNumber(value, 0) : toFixed ? roundNumberToFixedPrecision(value, n) : roundNumberToPrecision(value, n);
314
+ const result = noDecimalsAbove && value > noDecimalsAbove ? roundNumber(value, 0) : toFixed ? roundNumberToFixedPrecision(value, n) : (
315
+ //for comparison, old implementation from toPretty (functionally equivalent to new implementation, see tests)
316
+ //return Number(value.toExponential(n - 1).toString());
317
+ roundNumberToPrecision(value, n)
318
+ );
309
319
  return toFixed ? String(result) : result;
310
320
  };
311
321
  const roundByMagnitude = (value, n = DEFAULT_SIGNIFICANT_DIGITS) => {
@@ -404,11 +414,11 @@ const appendTrailingZeros = (value, numberOfZeros) => {
404
414
  return numberOfZeros > 0 && value !== "0" ? !value.includes(".") ? `${value}.${zeros}` : `${value}${zeros}` : value;
405
415
  };
406
416
  const formatDecimal = (value, thousandSeparator, preserveTrailingZeros = false) => {
407
- const convertedValue = convertNumberToLocale(toNum(value), "en-US").replaceAll(",", thousandSeparator);
408
- return preserveTrailingZeros ? appendTrailingZeros(
409
- convertedValue,
410
- countTrailingZeros(value, true)
411
- ) : convertedValue;
417
+ const convertedValue = convertNumberToLocale(
418
+ toNum(value),
419
+ "en-US"
420
+ ).replaceAll(",", thousandSeparator);
421
+ return preserveTrailingZeros ? appendTrailingZeros(convertedValue, countTrailingZeros(value, true)) : convertedValue;
412
422
  };
413
423
  const formatDecimalDisplayNumber = (value, options) => {
414
424
  const { nonBreakingSpace } = options ?? {};
@@ -425,10 +435,7 @@ const formatDecimalDisplayNumber = (value, options) => {
425
435
  return formatDecimal(value, space, options?.preserveTrailingZeros);
426
436
  };
427
437
  const formatScientificDisplayNumber = (value, options) => {
428
- const {
429
- roundScientificCoefficient,
430
- eNotation
431
- } = options ?? {};
438
+ const { roundScientificCoefficient, eNotation } = options ?? {};
432
439
  if (Number.isNaN(value)) {
433
440
  return "Invalid";
434
441
  }
@@ -667,8 +674,8 @@ function cleanNumStr(str) {
667
674
  }
668
675
  const stripLeadingZeros = (value) => {
669
676
  const isMinus = value?.[0] === "-";
670
- const matchMinus = /^-/mg;
671
- const matchLeadingZeros = /^(?:0+(?=[1-9])|0+(?=0))/mg;
677
+ const matchMinus = /^-/gm;
678
+ const matchLeadingZeros = /^(?:0+(?=[1-9])|0+(?=0))/gm;
672
679
  const cleanedValue = value.replace(matchMinus, "").replace(matchLeadingZeros, "");
673
680
  return isMinus ? `-${cleanedValue}` : cleanedValue;
674
681
  };
@@ -698,7 +705,9 @@ function newton(f, df, x0, tol = 1e-8, max_iter = 30) {
698
705
  }
699
706
  function erf(z) {
700
707
  const t = 1 / (1 + 0.5 * abs(z));
701
- const ans = 1 - t * exp(-(z ** 2) - 1.26551223 + t * (1.00002368 + t * (0.37409196 + t * (0.09678418 + t * (-0.18628806 + t * (0.27886807 + t * (-1.13520398 + t * (1.48851587 + t * (-0.82215223 + t * 0.17087277)))))))));
708
+ const ans = 1 - t * exp(
709
+ -(z ** 2) - 1.26551223 + t * (1.00002368 + t * (0.37409196 + t * (0.09678418 + t * (-0.18628806 + t * (0.27886807 + t * (-1.13520398 + t * (1.48851587 + t * (-0.82215223 + t * 0.17087277))))))))
710
+ );
702
711
  return z >= 0 ? ans : -ans;
703
712
  }
704
713
  function get_k_from_conf_int(a) {
@@ -729,7 +738,9 @@ function normalizeScientific(val) {
729
738
  const fixedLeft = normalizeExponent(val2.trim());
730
739
  return `${fixedLeft}|${unit.trim()}`;
731
740
  }
732
- const m = s.match(/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)\s*[eE]\s*[+-]?\s*\d+)\s+(.+)$/);
741
+ const m = s.match(
742
+ /^([+-]?(?:\d+(?:\.\d*)?|\.\d+)\s*[eE]\s*[+-]?\s*\d+)\s+(.+)$/
743
+ );
733
744
  if (m) return `${normalizeExponent(m[1])}|${m[2].trim()}`;
734
745
  return normalizeExponent(s);
735
746
  }
@@ -882,9 +893,9 @@ const LABELS = Object.freeze({
882
893
  mph: "mph",
883
894
  "km/h": "km/h",
884
895
  "m/s2": "m/s\xB2",
885
- "Gs": "Gs",
886
- "nT": "nT",
887
- "g": "g",
896
+ Gs: "Gs",
897
+ nT: "nT",
898
+ g: "g",
888
899
  "ft/s2": "ft/s\xB2",
889
900
  "Pa*s": "Pa\u22C5s",
890
901
  P: "P",
@@ -952,7 +963,15 @@ const LABELS = Object.freeze({
952
963
  });
953
964
  const ALT_UNITS = Object.freeze({
954
965
  acceleration: ["ft/s2", "m/s2"],
955
- angleGradient: ["deg/30m", "rad/m", "deg/m", "deg/ft", "rad/ft", "deg/100ft", "deg/10m"],
966
+ angleGradient: [
967
+ "deg/30m",
968
+ "rad/m",
969
+ "deg/m",
970
+ "deg/ft",
971
+ "rad/ft",
972
+ "deg/100ft",
973
+ "deg/10m"
974
+ ],
956
975
  angles: ["deg", "rad"],
957
976
  areaOther: ["in2", "ft2", "mm2", "cm2", "m2", "mile2", "km2"],
958
977
  areaTubular: ["in2", "cm2", "ft2", "m2"],
@@ -1025,23 +1044,36 @@ const ALT_UNITS = Object.freeze({
1025
1044
  permeability: ["mD", "m2"],
1026
1045
  power: ["hp", "W", "hhp", "MW", "kW", "BTU/h"],
1027
1046
  pressure: ["bar", "psi", "Pa", "kPa", "MPa", "ksi", "GPa", "lbf/100ft2"],
1028
- pressureGradient: ["bar/100m", "Pa/m", "bar/m", "psi/100ft", "psi/ft", "kPa/m"],
1047
+ pressureGradient: [
1048
+ "bar/100m",
1049
+ "Pa/m",
1050
+ "bar/m",
1051
+ "psi/100ft",
1052
+ "psi/ft",
1053
+ "kPa/m"
1054
+ ],
1029
1055
  pressurechange: ["bar", "psi", "Pa", "MPa", "kPa"],
1030
1056
  gasliftFlowRate: ["STB/d", "Sm3/d", "SCF/d"],
1031
1057
  productionFlowRate: ["MMSCFD", "STB/d", "Sm3/d", "MSm3/d", "SCF/d"],
1032
1058
  productionFlowRateOil: ["MMSCFD", "STB/d", "Sm3/d", "MSm3/d", "SCF/d"],
1033
1059
  productionFlowRateGas: ["MMSCFD", "STB/d", "Sm3/d", "MSm3/d", "SCF/d"],
1034
- injectionFlowRate: ["lpm", "lps", "bpm", "gpm", "MMSCFD", "STB/d", "Sm3/d", "MSm3/d", "SCF/d"],
1060
+ injectionFlowRate: [
1061
+ "lpm",
1062
+ "lps",
1063
+ "bpm",
1064
+ "gpm",
1065
+ "MMSCFD",
1066
+ "STB/d",
1067
+ "Sm3/d",
1068
+ "MSm3/d",
1069
+ "SCF/d"
1070
+ ],
1035
1071
  pumpRate: ["lpm", "lps", "bpm", "m3/s", "ft3/s", "gpm"],
1036
1072
  rotationalSpeed: ["rpm", "Hz"],
1037
1073
  roughness: ["m", "microM", "in"],
1038
1074
  rpm: ["rpm", "Hz"],
1039
1075
  sdstats: ["CI", "Sigma"],
1040
- specificHeatCapacity: [
1041
- "J/(kg*degC)",
1042
- "J/(kg*degK)",
1043
- "BTU/(lbm*degF)"
1044
- ],
1076
+ specificHeatCapacity: ["J/(kg*degC)", "J/(kg*degK)", "BTU/(lbm*degF)"],
1045
1077
  speed: ["km/h", "ft/min", "mph", "ft/h", "ft/s", "m/min", "m/s", "m/h"],
1046
1078
  inverseStandSpeed: ["d/stand", "h/stand", "min/stand", "s/stand"],
1047
1079
  rop: ["ft/h", "ft/min", "ft/s", "km/h", "m/h", "m/min", "m/s", "mph"],
@@ -1049,10 +1081,7 @@ const ALT_UNITS = Object.freeze({
1049
1081
  temperature: ["C", "F", "K"],
1050
1082
  pressurePerTemperature: ["Pa/C", "Bar/C", "psi/F", "psi/C"],
1051
1083
  tempgrad: ["C/100m", "F/100ft", "K/100m", "C/m", "F/ft", "K/m"],
1052
- thermalConductivity: [
1053
- "BTU/(h*ft*degF)",
1054
- "W/(mK)"
1055
- ],
1084
+ thermalConductivity: ["BTU/(h*ft*degF)", "W/(mK)"],
1056
1085
  thermalExpansionCoefficient: ["E-06/degC", "E-06/degF", "1/K"],
1057
1086
  torque: ["Nm", "ftlbf", "kNm"],
1058
1087
  torqueGradient: ["N", "lbf", "tonnes"],
@@ -1072,15 +1101,7 @@ const ALT_UNITS = Object.freeze({
1072
1101
  "MSm3",
1073
1102
  "SCF"
1074
1103
  ],
1075
- kickToleranceVolume: [
1076
- "m3",
1077
- "bbl",
1078
- "USGal",
1079
- "ft3",
1080
- "STB",
1081
- "Sm3",
1082
- "SCF"
1083
- ],
1104
+ kickToleranceVolume: ["m3", "bbl", "USGal", "ft3", "STB", "Sm3", "SCF"],
1084
1105
  weight: ["tonnes", "kg", "lbf", "mt", "kip", "N"],
1085
1106
  weightGradient: ["ppf", "kg/m"],
1086
1107
  wgrad: ["sg", "ppg"],
@@ -1092,7 +1113,20 @@ const ALT_UNITS = Object.freeze({
1092
1113
  shearStress: ["Pa", "lbf/100ft2"],
1093
1114
  sensorAccelerometer: ["g", "m/s2"],
1094
1115
  sensorMagnetometer: ["nT", "Gs"],
1095
- location: ["lk", "ftCla", "lkCla", "ftSe", "ydSe", "chSe", "chSe(T)", "ftGC", "ydInd", "ft", "m", "usft"],
1116
+ location: [
1117
+ "lk",
1118
+ "ftCla",
1119
+ "lkCla",
1120
+ "ftSe",
1121
+ "ydSe",
1122
+ "chSe",
1123
+ "chSe(T)",
1124
+ "ftGC",
1125
+ "ydInd",
1126
+ "ft",
1127
+ "m",
1128
+ "usft"
1129
+ ],
1096
1130
  mixingRequirements: ["m3/t", "L/100kg"],
1097
1131
  entalphy: ["J/kg", "kJ/kg", "BTU/lbm"]
1098
1132
  });
@@ -1323,8 +1357,8 @@ const KNOWN_CONVERSIONS = Object.freeze({
1323
1357
  "kg|tonnes": (val) => val / 1e3,
1324
1358
  "kg|mt": (val) => val / 1e3,
1325
1359
  /*
1326
- 1 kip = 1000 lbf - https://en.wikipedia.org/wiki/Kip_(unit)
1327
- */
1360
+ 1 kip = 1000 lbf - https://en.wikipedia.org/wiki/Kip_(unit)
1361
+ */
1328
1362
  "kg|kip": (val) => val * C.kg_to_lbf * 1e-3,
1329
1363
  "kgf|kg": (val) => val,
1330
1364
  "lbf|kg": (val) => val * C.lbf_to_kg,
@@ -1412,9 +1446,9 @@ const KNOWN_CONVERSIONS = Object.freeze({
1412
1446
  "Mm3/d|m3/d": (val) => val * 1e6,
1413
1447
  "m3/d|Mm3/d": (val) => val * 1e-6,
1414
1448
  /*
1415
- exact formula is 247854343 / 134687500000000 = 0.0000018402178598607888 - https://www.wolframalpha.com/input?i=STB%2Fd
1416
- STB has a lot of intermediate conversions, so to avoid delta during conversions trip we have to store 2 more digits
1417
- */
1449
+ exact formula is 247854343 / 134687500000000 = 0.0000018402178598607888 - https://www.wolframalpha.com/input?i=STB%2Fd
1450
+ STB has a lot of intermediate conversions, so to avoid delta during conversions trip we have to store 2 more digits
1451
+ */
1418
1452
  "STB/d|m3/s": (val) => val * 184021785986e-17,
1419
1453
  "Sm3/d|m3/d": (val) => val,
1420
1454
  // At a pressure of 101.325 kPa (760 Torr) and DIN 1343: a temperature of 273.15 K (0°C/32°F) | NOTE: Thomas suggested that we leep those conversions 1to1,
@@ -1880,9 +1914,13 @@ const INTERMEDIATE_CONVERSIONS = Object.freeze({
1880
1914
  //Entalphy
1881
1915
  "BTU/lbm": "J/kg"
1882
1916
  });
1883
- const KNOWN_UNITS = Object.freeze(Array.from(new Set(Object.values(ALT_UNITS).flat())));
1917
+ const KNOWN_UNITS = Object.freeze(
1918
+ Array.from(new Set(Object.values(ALT_UNITS).flat()))
1919
+ );
1884
1920
  const SPECIAL_NUMBERS = [NaN, -Infinity, Infinity];
1885
- const SPECIAL_NUMBERS_STRING = SPECIAL_NUMBERS.map((number) => number.toString());
1921
+ const SPECIAL_NUMBERS_STRING = SPECIAL_NUMBERS.map(
1922
+ (number) => number.toString()
1923
+ );
1886
1924
  const QUANTITIES_DESCRIPTION = {
1887
1925
  density: "Density",
1888
1926
  length: "Length",
@@ -2406,7 +2444,9 @@ function unum(numWithUnit, toUnit, fromUnit) {
2406
2444
  if (m[0] == null) m[0] = "0";
2407
2445
  if (m[1]) fromUnit = m[1];
2408
2446
  if (!fromUnit && toUnit !== fromUnit) {
2409
- throw new Error(`unum: unable to figure out unit: ${numWithUnit} fromUnit ${fromUnit}`);
2447
+ throw new Error(
2448
+ `unum: unable to figure out unit: ${numWithUnit} fromUnit ${fromUnit}`
2449
+ );
2410
2450
  }
2411
2451
  if (toUnit === fromUnit) {
2412
2452
  const v = m[0] ? toNum(m[0]) : 0;
@@ -2475,10 +2515,7 @@ function convertTable(toUnitRow, table, defaultUnitRow, removeFinalUnitsRow = fa
2475
2515
  return newTable;
2476
2516
  }
2477
2517
  function roundNumberWithLabel(value, n = 2) {
2478
- return displayNumber(
2479
- round(value, n),
2480
- { withUnit: true }
2481
- );
2518
+ return displayNumber(round(value, n), { withUnit: true });
2482
2519
  }
2483
2520
  function withUnit(value, unit, defaultVal = "") {
2484
2521
  if (value === null || value === "" || value === void 0) {
@@ -2526,7 +2563,10 @@ function convertSamePrecision(numWithUnit, toUnit, digits) {
2526
2563
  let j = prettyNumber.length;
2527
2564
  if (prettyNumber[--j] == "0") {
2528
2565
  while (prettyNumber[--j] == "0") ;
2529
- prettyNumber = prettyNumber.slice(0, j + (prettyNumber[j] == "." ? 0 : 1));
2566
+ prettyNumber = prettyNumber.slice(
2567
+ 0,
2568
+ j + (prettyNumber[j] == "." ? 0 : 1)
2569
+ );
2530
2570
  }
2531
2571
  }
2532
2572
  }
@@ -2538,7 +2578,10 @@ function altUnitsList(value, quantity) {
2538
2578
  v = withUnit(value, unitFromQuantity(quantity) ?? "");
2539
2579
  }
2540
2580
  const altUnits = ALT_UNITS[quantity] ?? [];
2541
- return altUnits.map((unit) => [...split(convertSamePrecision(v, unit)), label(unit)]);
2581
+ return altUnits.map((unit) => [
2582
+ ...split(convertSamePrecision(v, unit)),
2583
+ label(unit)
2584
+ ]);
2542
2585
  }
2543
2586
  function validateAndClean(previousValue, nextText) {
2544
2587
  const unit = split(previousValue)[1];
@@ -2549,7 +2592,10 @@ function validateAndClean(previousValue, nextText) {
2549
2592
  const stripDot = /^([^.]*\.)|\./g;
2550
2593
  const stripDotFollowedByE = /\.(?=e)/g;
2551
2594
  const stripMinus = /-|[eE]-/g;
2552
- const cleanedValue = nextText.replace(stripAllExceptNumeric, "").replace(stripE, "$1").replace(stripInvalidLeading, "").replace(replaceComma, ".").replace(stripDot, "$1").replace(stripDotFollowedByE, "").replace(stripMinus, (match, offset) => offset === 0 || match.toLowerCase() === "e-" ? match : "");
2595
+ const cleanedValue = nextText.replace(stripAllExceptNumeric, "").replace(stripE, "$1").replace(stripInvalidLeading, "").replace(replaceComma, ".").replace(stripDot, "$1").replace(stripDotFollowedByE, "").replace(
2596
+ stripMinus,
2597
+ (match, offset) => offset === 0 || match.toLowerCase() === "e-" ? match : ""
2598
+ );
2553
2599
  return !Number.isFinite(+cleanedValue) ? previousValue : `${cleanedValue}${unit ? "|" : ""}${unit}`;
2554
2600
  }
2555
2601
  function withPrettyUnitLabel(valueWithUnits) {
package/dist/units.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var numbers = require('./units-CJ3ckQN8.cjs');
3
+ var numbers = require('./units-DrwQLYMh.cjs');
4
4
  require('fraction.js');
5
5
 
6
6
 
package/dist/units.js CHANGED
@@ -1,2 +1,2 @@
1
- export { ae as EXP_NOTATION_RE, ad as SEPARATOR, i as altUnitsList, c as checkAndCleanDecimalComma, q as convertAndGetValue, x as convertAndGetValueStrict, p as convertSamePrecision, j as convertTable, g as getAltUnitsListByQuantity, b as getQuantities, o as getUnit, a as getUnitsForQuantity, n as getValue, m as isValueWithUnit, l as label, r as roundNumberWithLabel, s as showAltUnitsList, e as split, t as to, h as toBase, u as unitFromKey, d as unitFromQuantity, f as unum, k as unumWithUnit, v as validateAndClean, z as validateNumber, y as withPrettyUnitLabel, w as withUnit } from './units-CrmXBjNL.js';
1
+ export { ae as EXP_NOTATION_RE, ad as SEPARATOR, i as altUnitsList, c as checkAndCleanDecimalComma, q as convertAndGetValue, x as convertAndGetValueStrict, p as convertSamePrecision, j as convertTable, g as getAltUnitsListByQuantity, b as getQuantities, o as getUnit, a as getUnitsForQuantity, n as getValue, m as isValueWithUnit, l as label, r as roundNumberWithLabel, s as showAltUnitsList, e as split, t as to, h as toBase, u as unitFromKey, d as unitFromQuantity, f as unum, k as unumWithUnit, v as validateAndClean, z as validateNumber, y as withPrettyUnitLabel, w as withUnit } from './units-DKcliZbm.js';
2
2
  import 'fraction.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/units",
3
- "version": "4.5.2-beta-1",
3
+ "version": "4.5.2",
4
4
  "description": "Package for units management",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -35,9 +35,12 @@
35
35
  "scripts": {
36
36
  "compile-validators:build": "esbuild dist/validate/ajv-validators.js --bundle --allow-overwrite --platform=node --format=cjs --outfile=dist/validate/ajv-validators.js",
37
37
  "build": "pkgroll --clean-dist --tsconfig=tsconfig.build.json && cp README.md dist/",
38
- "lint": "eslint . --fix",
38
+ "lint:check": "oxlint .",
39
+ "lint:fix": "oxlint --fix .",
40
+ "formatting:check": "prettier --check '*/**/*.{ts,js,json}'",
41
+ "formatting:fix": "prettier --write '*/**/*.{ts,js,json}'",
39
42
  "start": "yarn link && yarn compile-validators && tsx watch src/index.ts",
40
- "test": "yarn compile-validators && jest --coverageThreshold \"{}\"",
43
+ "test": "yarn formatting:check && yarn lint:check && yarn compile-validators && jest --coverageThreshold \"{}\"",
41
44
  "test:watch": "jest --watchAll",
42
45
  "watch": "tsc -w -p tsconfig.dev.json",
43
46
  "validate-release-notes": "tsx scripts/validate-release-notes.ts",
@@ -46,33 +49,28 @@
46
49
  "prepare": "husky"
47
50
  },
48
51
  "lint-staged": {
49
- "*.ts": "npx eslint --fix"
52
+ "*/**/*.{ts,js,json}": [
53
+ "oxlint --fix",
54
+ "prettier --write"
55
+ ]
50
56
  },
51
57
  "dependencies": {
52
58
  "fraction.js": "^5.2.1"
53
59
  },
54
60
  "devDependencies": {
55
- "@commitlint/cli": "^19.7.1",
56
- "@commitlint/config-conventional": "^19.7.1",
57
- "@oliasoft-open-source/eslint-config-oliasoft": "^1.2.4",
61
+ "@prettier/plugin-oxc": "^0.1.3",
58
62
  "@types/jest": "^29.5.14",
59
63
  "@types/node": "^22.13.4",
60
- "@typescript-eslint/eslint-plugin": "^8.24.1",
61
- "@typescript-eslint/parser": "^8.24.1",
62
64
  "ajv": "^8.17.1",
63
65
  "ajv-errors": "^3.0.0",
64
66
  "ajv-keywords": "^5.1.0",
65
67
  "esbuild": "^0.25.0",
66
- "eslint": "^9.20.1",
67
- "eslint-config-prettier": "^10.0.1",
68
- "eslint-import-resolver-typescript": "^3.8.2",
69
- "eslint-plugin-import": "^2.31.0",
70
- "eslint-plugin-prettier": "^5.2.3",
71
68
  "husky": "^9.1.7",
72
69
  "jest": "^29.7.0",
73
70
  "lint-staged": "^15.4.3",
71
+ "oxlint": "^1.39.0",
74
72
  "pkgroll": "^2.10.0",
75
- "prettier": "^3.5.1",
73
+ "prettier": "^3.7.4",
76
74
  "ts-jest": "^29.2.5",
77
75
  "tsx": "^4.19.3",
78
76
  "typescript": "^5.7.3"