UNPKG

currency.js

Version:

A small, lightweight javascript library for working with currency values.

40 lines (37 loc) 1.03 kB
declare namespace currency { type Any = number | string | currency; interface Constructor { (value: currency.Any, opts?: currency.Options): currency, new (value: currency.Any, opts?: currency.Options): currency } interface Options { symbol?: string, separator?: string, decimal?: string, formatWithSymbol?: boolean, errorOnInvalid?: boolean, precision?: number, increment?: number, useVedic?: boolean, pattern?: string, negativePattern?: string, } } declare interface currency { add(number: currency.Any): currency; subtract(number: currency.Any): currency; multiply(number: currency.Any): currency; divide(number: currency.Any): currency; distribute(count: number): Array<currency>; dollars(): number; cents(): number; format(useSymbol?: boolean): string; toString(): string; toJSON(): number; readonly intValue: number; readonly value: number; } declare const currency : currency.Constructor; declare module 'currency.js' { export = currency; }