UNPKG

currency.js

Version:

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

35 lines (31 loc) 918 B
// @flow declare type $currency$any = number | string | currency; declare type $currency$opts = { symbol?: string, separator?: string, decimal?: string, formatWithSymbol?: boolean, errorOnInvalid?: boolean, precision?: number, increment?: number, useVedic?: boolean, pattern?: string, negativePattern?: string } declare class currency { static (value: $currency$any, opts?: $currency$opts): currency, constructor(value: $currency$any, opts?: $currency$opts): 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; +intValue: number; +value: number; } declare module.exports: typeof currency;