@thisisagile/easy
Version:
Straightforward library for building domain-driven microservice architectures
49 lines (47 loc) • 791 B
JavaScript
import {
asString
} from "./chunk-BDA5LB4S.mjs";
// src/utils/Convert.ts
var Convert = class {
constructor(from, to) {
this.from = from;
this.to = to;
}
};
var convert = {
default: new Convert(
(a) => a,
(a) => a
),
ignore: new Convert(
() => void 0,
() => void 0
),
toBool: {
fromNumber: new Convert(
(b) => b ? 1 : 0,
(n) => n !== 0
),
fromString: new Convert(
(b) => b ? "true" : "false",
(s) => s === "true"
)
},
toDate: {
fromString: new Convert(
(s) => new Date(s).toISOString(),
(s) => s
)
},
toNumber: {
fromString: new Convert(
(n) => asString(n),
(s) => parseInt(s)
)
}
};
export {
Convert,
convert
};
//# sourceMappingURL=chunk-MDXL65W4.mjs.map