MCPcopy Create free account
hub / github.com/GlobalTechInfo/MEGA-MD / formatNumber

Function formatNumber

plugins/units.js:138–143  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

136 return { result, category: cat };
137}
138function formatNumber(n) {
139 if (Math.abs(n) < 0.0001 || Math.abs(n) >= 1e12)
140 return n.toExponential(4);
141 const str = n.toPrecision(8).replace(/\.?0+$/, '');
142 return str;
143}
144export default {
145 command: 'units',
146 aliases: ['convert', 'conv', 'unit'],

Callers 1

handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected