UNPKG

measure-x

Version:

A lightweight and efficient **conversion utility** that supports various **number system conversions**, unit conversions, and more. 🚀

13 lines (11 loc) • 457 B
import { Converter } from "../../utils/converters"; import { ANGLE_CONVERSION } from "./constants"; import { AngleUnit } from "./types"; export const angleConverter: Converter = { category: "length", units: Object.keys(ANGLE_CONVERSION) as AngleUnit[], convert: (value: number, from: string, to: string): number => { const baseValue = value * ANGLE_CONVERSION[from as AngleUnit]; return baseValue / ANGLE_CONVERSION[to as AngleUnit]; }, };