UNPKG

any-unit-converter

Version:

A unit converter package allows users to convert values from one unit of measurement to another. It is designed to provide a convenient and easy-to-use solution for converting a wide range of units across various categories.

154 lines (153 loc) 3.59 kB
export interface TemperatureValue { fromBase: (value: number) => number; toBase: (value: number) => number; } export interface UnitConverterInterface { [index: string]: { [index: string]: { unitType: string; shortCode: string; conversionFactor: number | TemperatureValue; }[]; }; } export declare enum UNIT_TYPE { AREA = "area", DATA_TRANSFER_RATE = "data-transfer-rate", DIGITAL_STORAGE = "digital-storage", ENERGY = "energy", FREQUENCY = "frequency", FUEL_ECONOMICS = "fuel-economics", LENGTH = "length", MASS = "mass", PLANE_ANGLE = "plane-angle", PRESSURE = "pressure", SPEED = "speed", TEMPERATURE = "temperature", TIME = "time", VOLUME = "volume" } export declare enum Area { SquareKiloMeter = "km\u00B2", SquareMeter = "m\u00B2", SquareMile = "mi\u00B2", SquareYard = "yd\u00B2", SquareFoot = "ft\u00B2", SquareInch = "in\u00B2", Hectare = "ha", Acre = "ac" } export declare enum DataTransferRate { BitPerSecond = "bps", KilobitPerSecond = "kbps", KiloBytePerSecond = "KB/s", KibibitPerSecond = "Kibps", MegaBitPerSecond = "Mbps", MegaBytePerSecond = "MB/s", MebibitPerSecond = "Mib/s", GigaBitPerSecond = "Gbps", GigaBytePerSecond = "GB/s", GibibitPerSecond = "Gib/s", TeraBitPerSecond = "Tbpss", TeraBytePerSecond = "TB/s", TebibitPerSecond = "Tib/s" } export declare enum DigitalStorage { Gigabit = "Gb", Megabit = "Mb", Bit = "b", Kilobit = "kb", Mebibit = "Mibit", Kibibit = "Kibit", Terabit = "Tb", Petabyte = "PB", Pebibyte = "PiB" } export declare enum Energy { Joule = "J", Kilojoule = "kJ", WattHour = "Wh", KilowattHour = "kWh", Electronvolt = "eV", BritishThermalUnit = "BTU", USTherm = "thm" } export declare enum Frequency { Hertz = "Hz", Kilohertz = "kHz", Megahertz = "MHz", Gigahertz = "GHz" } export declare enum FuelEconomics { MilesPerGallon = "mpg", MilesPerGallonImperial = "mpgimp", KilometerPerLiter = "km/L", LiterPer100Kilometers = "L/100km" } export declare enum Length { Meter = "m", Centimeter = "cm", Micrometers = "um", Mile = "mi", Foot = "ft", Inch = "in", NauticalMile = "nmi" } export declare enum Mass { Tonne = "t", Kilogram = "kg", Gram = "g", Milligram = "mg", ImperialTon = "long-ton", USTon = "short-ton", Pound = "lb", Ounce = "oz", Stone = "st" } export declare enum PlaneAngle { Gradian = "grad", Radian = "rad", MinuteOfArc = "arcmin", Arcsecond = "arcsec" } export declare enum Pressure { StandardAtmosphere = "atm", Bar = "Bar", PoundPerSquareInch = "psi", Pascal = "Pa", Torr = "mmHg" } export declare enum Speed { FootPerSecond = "fps", MilePerHour = "mph", MeterPerSecond = "m/s", KilometerPerHour = "km/h", Knot = "kt" } export declare enum Temperature { DegreeCelsius = "C", Fahrenheit = "F", Kelvin = "K" } export declare enum Time { Microsecond = "us", Nanosecond = "ns", Minute = "min", Second = "s", Day = "d", Hour = "h", Month = "mo", Week = "wk", CalendarYear = "yr", Decade = "dec" } export declare enum Volume { USLiquidQuart = "short-qt", USLiquidGallon = "short-gal", USLiquidPint = "short-pt", USLegalCup = "UScp", Liter = "L", CubicMeter = "m\u00B3", ImperialQuart = "long-qt", ImperialGallon = "long-gal" }