MCPcopy
hub / github.com/RomRider/apexcharts-card / myFormatNumber

Function myFormatNumber

src/utils.ts:312–328  ·  view source on GitHub ↗
(
  num: string | number | null | undefined,
  localeOptions?: FrontendLocaleData,
  precision?: number | undefined,
)

Source from the content-addressed store, hash-verified

310}
311
312export function myFormatNumber(
313 num: string | number | null | undefined,
314 localeOptions?: FrontendLocaleData,
315 precision?: number | undefined,
316): string | null {
317 let lValue: string | number | null | undefined = num;
318 if (lValue === undefined || lValue === null) return null;
319 if (typeof lValue === 'string') {
320 lValue = parseFloat(lValue);
321 if (Number.isNaN(lValue)) {
322 return num as string;
323 }
324 }
325 return formatNumber(lValue, localeOptions, {
326 maximumFractionDigits: precision === undefined ? DEFAULT_FLOAT_PRECISION : precision,
327 });
328}
329
330export function computeTimezoneDiffWithLocal(timezone: string | undefined): number {
331 if (!timezone) return 0;

Callers 6

_getPointAnnotationStyleFunction · 0.90
apexcharts-card.tsFile · 0.90
getYTooltipFormatterFunction · 0.90
getDataLabelsFormatterFunction · 0.90
getPlotOptions_radialBarFunction · 0.90
getLegendFormatterFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected