measure-x
Version:
A lightweight and efficient **conversion utility** that supports various **number system conversions**, unit conversions, and more. 🚀
38 lines (36 loc) • 1.75 kB
text/typescript
import { VolumeUnit } from "./types";
export const VOLUME_CONVERSION: Record<VolumeUnit, number> = {
"Cubic Meter": 1, // Base unit
"Cubic Kilometer": 1e9, // 1 km³ = 1,000,000,000 m³
"Cubic Centimeter": 1e-6, // 1 cm³ = 0.000001 m³
"Cubic Millimeter": 1e-9, // 1 mm³ = 0.000000001 m³
"Cubic Micrometer": 1e-18, // 1 µm³ = 1e-18 m³
"Cubic Mile": 4.168e9, // 1 mi³ = 4,168,000,000 m³
"Cubic Yard": 0.764555, // 1 yd³ = 0.764555 m³
"Cubic Foot": 0.0283168, // 1 ft³ = 0.0283168 m³
"Cubic Inch": 0.000016387, // 1 in³ = 0.000016387 m³
Liter: 0.001, // 1 L = 0.001 m³
Milliliter: 1e-6, // 1 mL = 0.000001 m³
Hectoliter: 0.1, // 1 hL = 0.1 m³
Centiliter: 0.00001, // 1 cL = 0.00001 m³
Deciliter: 0.0001, // 1 dL = 0.0001 m³
Megaliter: 1000, // 1 ML = 1000 m³
Microliter: 1e-9, // 1 µL = 1e-9 m³
Nanoliter: 1e-12, // 1 nL = 1e-12 m³
Picoliter: 1e-15, // 1 pL = 1e-15 m³
"Acre-Foot": 1233.48, // 1 acre-ft = 1233.48 m³
"Board Foot": 0.00235974, // 1 board foot = 0.00235974 m³
Bushel: 0.0352391, // 1 bushel = 0.0352391 m³
Dram: 0.00000369669, // 1 dram = 0.00000369669 m³
"Fluid Ounce": 0.0000295735, // 1 fl oz = 0.0000295735 m³
Gallon: 0.00378541, // 1 gallon (US) = 0.00378541 m³
Quart: 0.000946353, // 1 quart = 0.000946353 m³
Pint: 0.000473176, // 1 pint = 0.000473176 m³
Cup: 0.00024, // 1 cup (US) ≈ 0.00024 m³
Tablespoon: 0.0000147868, // 1 tbsp = 0.0000147868 m³
Teaspoon: 0.00000492892, // 1 tsp = 0.00000492892 m³
"Oil Barrel": 0.158987, // 1 oil barrel = 0.158987 m³
"Beer Barrel": 0.117347, // 1 beer barrel = 0.117347 m³
"Register Ton": 2.83168, // 1 register ton = 2.83168 m³
"Metric Cup": 0.00025, // 1 metric cup = 0.00025 m³
};