0

When using code like var out = numeral(100000).format('0.[000]a') I want to see '0.1m', not '100k' ('0.[000]a') nor '100.000k' ('0.000a') nor 'k' ('.[000]a'). The values in parenthesis are the format string I tried for each result.

Said another way, how would I remove any leading significant digits with the format string. To force a '0.*' output (or in RegEx format '0..+').

I've found http://numeraljs.com/ and read through the documentation as best I can. I see many ways to force characters to appear in the output, but not how to force a number to a higher unit and as a decimal.

I'm limited by what my script runner allows. It's inside a game, Bitburner, that offers a JavaScript (NodeJS + Electron) environment including numeral.js for formatting. I looked at their documentation too, but it's sparse. It gives 3 examples and a link to the main documentation.
https://bitburner-beta.readthedocs.io/en/latest/netscript/basicfunctions/nFormat.html

0 Answers0