class LengthUnit {
    static Millimeter = new LengthUnit(1000);
    static Centimeter = new LengthUnit(100);
    static Meter = new LengthUnit(1);
    static Kilometer = new LengthUnit(0.001);
    static Mile = new LengthUnit(0.0006213712);
    scaleFactor;
    constructor(scaleFactor) {
        this.scaleFactor = scaleFactor;
    }
    to(unit, value) {
        if (unit.scaleFactor === this.scaleFactor) {
            return value;
        }
        // Convert to primary unit.
        const primaryValue = value / this.scaleFactor;
        // Convert to destination unit.
        return primaryValue * unit.scaleFactor;
    }
}

export { LengthUnit };
//# sourceMappingURL=LengthUnit.js.map
