UNPKG

@cranberry-money/shared-utils

Version:

Shared utility functions for Blueberry platform

14 lines 416 B
export function formatQuantityWithSuffix(quantity, decimals = 1) { const million = 1000000; const thousand = 1000; if (quantity >= million) { return `${(quantity / million).toFixed(decimals)}M`; } else if (quantity >= thousand) { return `${(quantity / thousand).toFixed(decimals)}K`; } else { return quantity.toString(); } } //# sourceMappingURL=numbers.js.map