@jeremyckahn/farmhand
Version:
A farming game
17 lines (14 loc) • 413 B
JavaScript
import { dinero, toDecimal, USD } from 'dinero.js'
/**
* @param {number} number
* @returns {string} Include dollar sign and other formatting, as well as cents.
*/
export const moneyString = number =>
toDecimal(
dinero({ amount: Math.round(number * 100), currency: USD }),
({ value }) =>
Number(value).toLocaleString('en-US', {
style: 'currency',
currency: 'USD',
})
)