UNPKG

818 BTypeScriptView Raw
1import { Options } from './lib/options.js';
2export default class Cashify {
3 readonly options: Partial<Options>;
4 /**
5 * @constructor
6 * @param {Object} [options] Conversion options.
7 */
8 constructor(options: Partial<Options>);
9 /**
10 * Function, which converts currencies based on provided rates.
11 *
12 * @param {number | string} amount - Amount of money you want to convert.
13 * @param {Object} [options] - Conversion options.
14 * @return {number} Conversion result.
15 *
16 * @example
17 * const rates = {
18 * GBP: 0.92,
19 * EUR: 1.00,
20 * USD: 1.12
21 * };
22 *
23 * const cashify = new Cashify({base: 'EUR', rates});
24 *
25 * cashify.convert(10, {from: 'EUR', to: 'GBP'}); //=> 9.2
26 */
27 convert(amount: number | string, options?: Partial<Options>): number;
28}