UNPKG

convert

Version:

The smallest & fastest library for really easy, totally type-safe unit conversions in TypeScript & JavaScript

14 lines (13 loc) 527 B
import type { Converter } from "../types/converter.cjs"; import type { MeasuresByUnit, Unit } from "../types/units.cjs"; /** * 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>>;