MCPcopy Index your code
hub / github.com/monkeytypegame/monkeytype / number

Method number

frontend/src/ts/utils/format.ts:81–97  ·  view source on GitHub ↗
(
    value: number | null | undefined,
    formatOptions: FormatOptions,
  )

Source from the content-addressed store, hash-verified

79 }
80
81 private number(
82 value: number | null | undefined,
83 formatOptions: FormatOptions,
84 ): string {
85 if (value === undefined || value === null) {
86 return formatOptions.fallback ?? "";
87 }
88 const suffix = formatOptions.suffix ?? "";
89
90 if (
91 formatOptions.showDecimalPlaces ??
92 this.config.alwaysShowDecimalPlaces
93 ) {
94 return Numbers.roundTo2(value).toFixed(2) + suffix;
95 }
96 return (formatOptions.rounding ?? Math.round)(value).toString() + suffix;
97 }
98
99 rank(
100 position: number | null | undefined,

Callers 15

typingSpeedMethod · 0.95
percentageMethod · 0.95
decimalsMethod · 0.95
results.tsFile · 0.80
quotes.tsFile · 0.80
users.tsFile · 0.80
webhooks.tsFile · 0.80
dev.tsFile · 0.80
leaderboards.tsFile · 0.80
connections.tsFile · 0.80
configs.tsFile · 0.80
shared.tsFile · 0.80

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected