MCPcopy
hub / github.com/josdejong/mathjs / format

Function format

bin/cli.js:83–96  ·  view source on GitHub ↗

* Helper function to format a value. Regular numbers will be rounded * to 14 digits to prevent round-off errors from showing up. * @param {*} value

(value)

Source from the content-addressed store, hash-verified

81 * @param {*} value
82 */
83function format (value) {
84 const { math } = getMath()
85
86 return math.format(value, {
87 fn: function (value) {
88 if (typeof value === 'number') {
89 // round numbers
90 return math.format(value, PRECISION)
91 } else {
92 return math.format(value)
93 }
94 }
95 })
96}
97
98/**
99 * auto complete a text

Callers 10

format.test.jsFile · 0.90
string.test.jsFile · 0.90
number.test.jsFile · 0.90
formatter.test.jsFile · 0.90
esmApp.jsFile · 0.90
runStreamFunction · 0.70
testTypes.tsFile · 0.50
commonjsApp.cjsFile · 0.50

Calls 2

getMathFunction · 0.85
formatMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…