/** * Applies the fraction digit to the given amount. * Positive fraction digit moves the decimal to the right, negative to the left. (i.e. adding or removing zeros from either end) * * @example (10, -2) => 0.1 * @example (10, -1) => 1 * @example (10, 0) => 10 * @example (10, 1) => 100 * @example (10, 2) => 1000 * @example (12345, -3) => 12,345 * @example (12345, -2) => 123,45 * @example (12345, -1) => 1234,5 * @example (12345, 0) => 12345 * @example (12345, 1) => 123450 * @example (12345, 2) => 1234500 * @example (12345, 3) => 12345000 * * * @param amount Integer value to apply the fraction digit to * @param fractionDigit The fraction digit to apply * @throws an Error if the given fraction digit (either via mapping or directly) is not a integer value */ declare const convert: (amount: number, fractionDigit: number) => number; type ConvertWithMappingOptions = { /** * A mapping where the key is the ISO 4217 currency code value and the value is the fraction digit (integer value) to apply. */ mapping: Map; /** * The amount to apply the fraction digit to */ amount: number; /** * The currency code that belongs to this amount. This is used to lookup the value in the mapping to see if it needs to be overruled */ currencyCode: string; /** * The fraction digit */ fractionDigit?: number; }; /** * Applies the given fraction digit to the amount with the possibility to overrule the fraction digit via the supplied mapping. * * @param options The options to use with converting * * @function convert for more information how the fractionDigit is applied * * @returns The original value if neither the overruling fraction digit is found or no fraction digit is given, otherwise returns the converted value based on either the overruling fraction digit or fraction digit * * @throws an Error if the given fraction digit (either via mapping or directly) is not a integer value */ declare const convertWithMapping: (options: ConvertWithMappingOptions) => number; export { convert, convertWithMapping }; export type { ConvertWithMappingOptions };