diff --git a/types/accounting/accounting-tests.ts b/types/accounting/accounting-tests.ts index a397c559eb..41150f7a37 100644 --- a/types/accounting/accounting-tests.ts +++ b/types/accounting/accounting-tests.ts @@ -3,6 +3,9 @@ // Default usage: accounting.formatMoney(12345678); // $12,345,678.00 +// Stringified usage: +accounting.formatMoney('$4394958309392.9401'); // $4,394,958,309,392.94 + // European formatting (custom symbol and separators), could also use options object as second param: accounting.formatMoney(4999.99, "€", 2, ".", ","); // €4.999,99 diff --git a/types/accounting/index.d.ts b/types/accounting/index.d.ts index ef8991999f..9234a79261 100644 --- a/types/accounting/index.d.ts +++ b/types/accounting/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for accounting.js 0.3 +// Type definitions for accounting.js 0.4 // Project: http://josscrowcroft.github.io/accounting.js/ // Definitions by: Sergey Gerasimov +// Christopher Eck // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace accounting { @@ -30,9 +31,9 @@ declare namespace accounting { } interface Static { - // format any number into currency - formatMoney(number: number, symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string; - formatMoney(number: number, options: CurrencySettings | CurrencySettings): string; + // format any number or stringified number into currency + formatMoney(number: number | string, symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string; + formatMoney(number: number | string, options: CurrencySettings | CurrencySettings): string; formatMoney(numbers: number[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[]; formatMoney(numbers: number[], options: CurrencySettings | CurrencySettings): string[];