convert
Version:
The smallest & fastest library for really easy, totally type-safe unit conversions in TypeScript & JavaScript
14 lines (13 loc) • 525 B
TypeScript
import type { Converter } from "../types/converter.js";
import type { MeasuresByUnit, Unit } from "../types/units.js";
/**
* Convert a given quantity of a unit into another unit.
*
* @param quantity - The quantity of the `from` unit you want to convert
* @param from - The unit you are converting from
*
* @returns An object you can use to convert the provided quantity
*
* @public
*/
export declare function convert<Q extends number | bigint, U extends Unit>(quantity: Q, from: U): Converter<Q, MeasuresByUnit<U>>;