PHP 7.4.33
Preview: formatDecimal.js Size: 822 B
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/d3-format/src/formatDecimal.js
export default function(x) {
  return Math.abs(x = Math.round(x)) >= 1e21
      ? x.toLocaleString("en").replace(/,/g, "")
      : x.toString(10);
}

// Computes the decimal coefficient and exponent of the specified number x with
// significant digits p, where x is positive and p is in [1, 21] or undefined.
// For example, formatDecimalParts(1.23) returns ["123", 0].
export function formatDecimalParts(x, p) {
  if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
  var i, coefficient = x.slice(0, i);

  // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
  // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
  return [
    coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
    +x.slice(i + 1)
  ];
}

Directory Contents

Dirs: 0 × Files: 16
Name Size Perms Modified Actions
348 B lrw-r--r-- 2026-04-28 09:11:39
Edit Download
149 B lrw-r--r-- 2026-04-28 09:11:39
Edit Download
822 B lrw-r--r-- 2026-04-28 09:11:39
Edit Download
475 B lrw-r--r-- 2026-04-28 09:11:39
Edit Download
154 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
631 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
473 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.68 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
399 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
627 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
43 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
415 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
6.03 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
122 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
193 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
189 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).