import type { FieldMapType } from "./types"; export default class AutoMapper { private static mappings; /** * * @param key Unique identifier for the mapping you created with .create() * @param mappings You field mappings from A to B * @example * ```ts * type FromType = { age: string }; * type ToType = { age: number }; * * AutoMapper.create("UNIK_KEY", [ * ["age", ({ age }) => +(age || 0)], * ]); * ``` */ static create: (key: string, mappings: FieldMapType[]) => void; /** * * @param key Unique identifier for the mapping you created with .create() * @param rawObject Your raw object * @returns Your DTO object, converted from your raw object * @example * ```ts * type FromType = { age: string }; * type ToType = { age: number }; * * const output: ToType = AutoMapper.apply("UNIK_KEY", { age: "31" }); * ``` */ static apply: (key: string, rawObject: A) => B; }