UNPKG

@jlucaspains/sharp-recipe-parser

Version:
32 lines 1.87 kB
/** * This function retrieves the units for a given language. * It uses a Map of units, where the key is the language. * If no units are found for the given language, it returns null. * @param {Types.ValidLanguages} language - The language to get the units for. * @returns {Types.Units | null} The units for the given language, or null if no units are found. */ export function getUnits(language: Types.ValidLanguages): Types.Units | null; /** * This function converts a value from one unit to another. * It uses a Map of converters, where the key is a string in the format 'from->to'. * If no converter is found for the given units, it throws an error. * @param {number} input - The value to be converted. * @param {string} from - The unit of the input value. * @param {string} to - The unit to convert the input value to. * @param {Types.Units} units - The units object containing unit conversions. * @returns {number} The converted value. * @throws {Error} Throws an error if no conversion is found for the given units. */ export function convert(input: number, from: string, to: string, units: Types.Units): number; /** * This function rounds a number to a specified number of decimal places. * It uses the toLocaleString method to format the number with the specified minimum and maximum number of fraction digits. * The formatted number is then converted back to a Number and returned. * @param {number} value - The number to be rounded. * @param {number} minimumFractionDigits - The minimum number of fraction digits to use. * @param {number} maximumFractionDigits - The maximum number of fraction digits to use. * @returns {number} The rounded number. */ export function round(value: number, minimumFractionDigits: number, maximumFractionDigits: number): number; import * as Types from "./types.js"; //# sourceMappingURL=units.d.ts.map