mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Merge branch 'davidmpaz-master'
This commit is contained in:
@@ -3,12 +3,21 @@ import currencyFormatter = require('currency-formatter');
|
||||
currencyFormatter.format(1000000, { code: 'USD' });
|
||||
// => '$1,000,000.00'
|
||||
|
||||
currencyFormatter.unformat('$1,000,000.00', { code: 'USD' });
|
||||
// => 1000000
|
||||
|
||||
currencyFormatter.format(1000000, { code: 'GBP' });
|
||||
// => '£1,000,000.00'
|
||||
|
||||
currencyFormatter.unformat('£1,000,000.00', { code: 'GBP' });
|
||||
// => 1000000
|
||||
|
||||
currencyFormatter.format(1000000, { code: 'EUR' });
|
||||
// => '1 000 000,00 €'
|
||||
|
||||
currencyFormatter.unformat('1 000 000,00 €', { code: 'EUR' });
|
||||
// => 1000000
|
||||
|
||||
currencyFormatter.findCurrency('USD');
|
||||
// returns:
|
||||
// {
|
||||
|
||||
Vendored
+17
-1
@@ -1,6 +1,7 @@
|
||||
// Type definitions for currency-formatter 1.0
|
||||
// Type definitions for currency-formatter 1.3
|
||||
// Project: https://github.com/smirzaei/currency-formatter#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// David Paz <https://github.com/davidmpaz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface Currency {
|
||||
@@ -18,6 +19,7 @@ export const defaultCurrency: Currency;
|
||||
export function findCurrency(currencyCode: string): Currency;
|
||||
export function format(value: number, options: {
|
||||
code?: string,
|
||||
locale?: string,
|
||||
symbol?: string,
|
||||
decimal?: string,
|
||||
thousand?: string,
|
||||
@@ -28,3 +30,17 @@ export function format(value: number, options: {
|
||||
zero: string
|
||||
}
|
||||
}): string;
|
||||
|
||||
export function unformat(value: string, options: {
|
||||
code?: string,
|
||||
locale?: string,
|
||||
symbol?: string,
|
||||
decimal?: string,
|
||||
thousand?: string,
|
||||
precision?: number,
|
||||
format?: string | {
|
||||
pos: string,
|
||||
neg: string,
|
||||
zero: string
|
||||
}
|
||||
}): number;
|
||||
|
||||
Reference in New Issue
Block a user