1 | import formatDefault from "./formatDefault";
|
2 | import formatPrefixAuto from "./formatPrefixAuto";
|
3 | import formatRounded from "./formatRounded";
|
4 |
|
5 | export default {
|
6 | "": formatDefault,
|
7 | "%": function(x, p) { return (x * 100).toFixed(p); },
|
8 | "b": function(x) { return Math.round(x).toString(2); },
|
9 | "c": function(x) { return x + ""; },
|
10 | "d": function(x) { return Math.round(x).toString(10); },
|
11 | "e": function(x, p) { return x.toExponential(p); },
|
12 | "f": function(x, p) { return x.toFixed(p); },
|
13 | "g": function(x, p) { return x.toPrecision(p); },
|
14 | "o": function(x) { return Math.round(x).toString(8); },
|
15 | "p": function(x, p) { return formatRounded(x * 100, p); },
|
16 | "r": formatRounded,
|
17 | "s": formatPrefixAuto,
|
18 | "X": function(x) { return Math.round(x).toString(16).toUpperCase(); },
|
19 | "x": function(x) { return Math.round(x).toString(16); }
|
20 | };
|