kanel-kysely
Version:
Kysely extension for Kanel
29 lines (28 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.kyselyCamelCaseHook = void 0;
const recase_1 = require("@kristiandupont/recase");
const toCamelCase = (0, recase_1.recase)(null, "camel");
const kyselyCamelCaseHook = (output, _context) => Object.fromEntries(Object.entries(output).map(([path, fileContents]) => {
if (fileContents.fileType === "typescript") {
return [
path,
{
...fileContents,
declarations: fileContents.declarations.map((declaration) => declaration.declarationType === "interface"
? {
...declaration,
properties: declaration.properties.map((property) => ({
...property,
name: toCamelCase(property.name),
})),
}
: declaration),
},
];
}
else {
return [path, fileContents];
}
}));
exports.kyselyCamelCaseHook = kyselyCamelCaseHook;