Skip to content

@pgege/kaboo-react


Function: formatCost()

formatCost(cost): string

Defined in: src/formatters/tokens.ts:34

Formats a dollar cost for compact display: 2.14159 -> "$2.14", 0.163 -> "$0.16", values below half a cent -> "<$0.01".

Parameters

cost

number

Returns

string

Example

import { formatCost } from "@pgege/kaboo-react";

formatCost(0.163068); // "$0.16"