UNPKG

monzolib

Version:

Fully Featured JS/Node Monzo Library

57 lines (56 loc) 1.56 kB
export declare type SignModes = 'always' | 'onlyPositive' | 'onlyNegative' | 'never'; export declare class Amount { private readonly domestic; private readonly local?; private readonly formatter; constructor({ domestic, local }: AmountOpts); get currency(): string; get foreign(): boolean; get exchanged(): Amount | undefined; get negative(): boolean; get positive(): boolean; get sign(): string; get amount(): number; get exponent(): number; get scale(): number; get raw(): number; formatParts({ showCurrency, signMode, }?: AmountFormatOpts): Intl.NumberPart[]; format(formatOpts?: AmountFormatOpts): string; html(formatOpts?: AmountFormatOpts): string; get json(): AmountOpts; get stringify(): string; add(amount: Amount): Amount; toString(): string; valueOf(): number; } export interface CurrencyDefinition { symbol: string; separator: string; } export interface CurrencyLibrary { [currency: string]: CurrencyDefinition; } export interface SimpleAmount { amount: number; currency: string; } export interface AmountOpts { domestic: SimpleAmount; local?: SimpleAmount; } export interface AmountFormatOpts { showCurrency?: boolean; signMode?: SignModes; } export interface MonzoBalanceResponse { balance: number; total_balance: number; currency: string; local_currency: string; local_exchange_rate: number; local_spend: { spend_today: number; currency: string; }[]; spend_today: number; }