Files
recipe-app/backend/dist/common/utils/units.d.ts
T
Nils-Johan Gynther 969dafdbc6
Test Suite / test (24.15.0) (push) Has been cancelled
Refactor code structure for improved readability and maintainability
2026-05-06 07:37:59 +02:00

15 lines
668 B
TypeScript

export type UnitType = 'weight' | 'volume' | 'cooking' | 'piece' | 'other';
export interface UnitDefinition {
value: string;
labelSv: string;
type: UnitType;
toBaseFactor: number;
aliases: string[];
}
export declare const UNIT_DEFINITIONS: UnitDefinition[];
export declare function normalizeUnit(unit: string): string;
export declare function getUnitDefinition(unit: string): UnitDefinition | undefined;
export declare function getUnitType(unit: string): UnitType | null;
export declare function canConvert(fromUnit: string, toUnit: string): boolean;
export declare function convertUnit(quantity: number, fromUnit: string, toUnit: string): number;