'use strict';

/*!
 * @techmely/utils
 * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
 * MIT Licensed
 */


// src/isNumber.ts
function isNumber(val) {
  return toString.call(val) === "[object Number]";
}

// src/formatNumber.ts
function formatNumber(num, precision = 0, defaultValue = "-") {
  if (!isNumber(num)) {
    return defaultValue;
  }
  return num.toLocaleString("en", {
    minimumFractionDigits: precision,
    maximumFractionDigits: precision
  });
}

exports.formatNumber = formatNumber;
