// ../shared/utils/dist/src/helpers.js
function isNumeric(n) {
  const v = typeof n != "string" || n === "" ? n : Number(n);
  const f = parseFloat(n);
  return !isNaN(f) && Number.isFinite(v) && v === f;
}
function isStrictNumeric(n) {
  return typeof n === "number" && Number.isFinite(n);
}
function convertUnits(v, fromUnit, toUnit, scaleFactor, compact) {
  if (scaleFactor >= 1) {
    const toUnitV2 = Math.floor(v * scaleFactor);
    if (compact) return `${toUnitV2}${toUnit.charAt(0)}`;
    return `${toUnitV2} ${toUnitV2 > 1 ? toUnit + "s" : ""}`;
  }
  const toUnitV = Math.floor(v * scaleFactor);
  const fromUnitV = Math.ceil(v % (1 / scaleFactor));
  if (fromUnitV == 0) {
    if (compact) return `${toUnitV}${toUnit.charAt(0)}`;
    return `${toUnitV} ${toUnitV > 1 ? toUnit + "s" : ""}`;
  }
  if (compact) return `${toUnitV}${toUnit.charAt(0)}${fromUnitV}${fromUnit.charAt(0)}`;
  return `${toUnitV} ${toUnitV > 1 ? toUnit + "s" : toUnit} ${fromUnitV} ${fromUnitV > 1 ? fromUnit + "s" : fromUnit}`;
}
var CustomError = class extends Error {
  constructor(message, opts = {}) {
    super(message);
    this.level = "";
    if (opts.name) this.name = opts.name;
    if (opts.code) this.code = opts.code;
    if (opts.level) this.level = opts.level;
  }
};

export {
  isNumeric,
  isStrictNumeric,
  convertUnits,
  CustomError
};
//# sourceMappingURL=chunk-JNITUVXP.js.map
