1 | import { Options } from './lib/options.js';
|
2 | /**
|
3 | * Function, which converts currencies based on provided rates.
|
4 | *
|
5 | * @param {number | string} amount - Amount of money you want to convert.
|
6 | * @param {Object} options - Conversion options.
|
7 | * @param {new (value: BigSource) => Big} fn - Optional, Big.js constructor - useful to avoid floating point errors.
|
8 | * @return {number} Conversion result.
|
9 | *
|
10 | * @example
|
11 | * const rates = {
|
12 | * GBP: 0.92,
|
13 | * EUR: 1.00,
|
14 | * USD: 1.12
|
15 | * };
|
16 | *
|
17 | * convert(10, {from: 'EUR', to: 'GBP', base: 'EUR', rates}); //=> 9.2
|
18 | */
|
19 | export default function convert(amount: number | string, { from, to, base, rates, BigJs }: Options): number;
|