import { memoizeJ } from "@thi.ng/memoize/memoizej" ; import type { Stringer } from "./api.js" ; export const currency = < ( sym : string , pre ? : boolean , prec ? : number ) => Stringer < number > > memoizeJ ( ( sym , pre = true , prec = 2 ) => { const ff = ( x ) => x . toFixed ( prec ) ; return pre ? ( x ) => sym + ff ( x ) : ( x ) => ff ( x ) + sym ; } ) ; export const chf = currency ( "CHF " ) ; export const eur = currency ( "€" ) ; export const gbp = currency ( "£" ) ; export const usd = currency ( "$" ) ; export const yen = currency ( "¥" ) ;