Download node_modules/d3-format/src/formatRounded.js from NKessler/Horizon: direct link, hf CLI and curl.
- Browser
- Download file 473 Bytes
-
https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-format/src/formatRounded.js
- Command line
-
hf download hf://NKessler/Horizon/node_modules/d3-format/src/formatRounded.js
-
curl -L -o formatRounded.js https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-format/src/formatRounded.js
473 Bytes
| import {formatDecimalParts} from "./formatDecimal.js"; | |
| export default function(x, p) { | |
| var d = formatDecimalParts(x, p); | |
| if (!d) return x + ""; | |
| var coefficient = d[0], | |
| exponent = d[1]; | |
| return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient | |
| : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) | |
| : coefficient + new Array(exponent - coefficient.length + 2).join("0"); | |
| } | |