MCPcopy Create free account
hub / github.com/Effect-TS/effect / printNumber

Function printNumber

packages/effect/src/encoding/Yaml.ts:1710–1716  ·  view source on GitHub ↗
(value: number)

Source from the content-addressed store, hash-verified

1708const pad = (width: number): string => pads[width] ?? (pads[width] = " ".repeat(width))
1709
1710const printNumber = (value: number): string => {
1711 if (Number.isNaN(value)) return ".nan"
1712 if (value === Number.POSITIVE_INFINITY) return ".inf"
1713 if (value === Number.NEGATIVE_INFINITY) return "-.inf"
1714 if (Object.is(value, -0)) return "-0.0"
1715 return String(value)
1716}
1717
1718// Use a literal block only when lines need no escaping or surrounding-whitespace preservation.
1719const literalBlock = (text: string): { readonly header: string; readonly lines: Array<string> } | undefined => {

Callers 1

nodeMethod · 0.85

Calls 2

isMethod · 0.65
StringFunction · 0.50

Tested by

no test coverage detected