Skip to main content

formatFixed

Formats a number with a fixed count of decimals, always with a dot separator, and never as a negative zero.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { formatFixed } from "@mapcairn/core";

function formatFixed(value: number, decimals: number): string;

Parameters​

  • value (number)
  • decimals (number)

Returns​

string

Remarks​

Built on toFixed, which ignores the process locale, so coordinates read the same everywhere. A value that rounds to zero loses its sign.

Source: packages/core/src/format/format.ts:14