import type { Calculator , Dinero , DineroOptions } from '../types' ; export type CreateDineroOptions < TAmount > = { readonly calculator : Calculator < TAmount > ; readonly onCreate ? : ( options : DineroOptions < TAmount > ) => void ; } ; export function createDinero < TAmount > ( { calculator , onCreate , } ) { return function dinero ( { amount , currency , scale = currency . exponent , } ) : Dinero < TAmount > { onCreate ?. ( { amount , currency , scale } ) ; return { calculator , create : dinero , toJSON ( ) { return { amount , currency , scale , } ; } , } ; } ; }