easy-nest-generator
Version:
generate interface, hooks for nestjs project
28 lines • 736 B
JavaScript
export function cleanType(typeText) {
const jsPrimitives = [
"string",
"number",
"boolean",
"null",
"undefined",
"void",
"date",
"any",
];
if (jsPrimitives.includes(typeText.toLowerCase()) ||
(typeText.endsWith("[]") &&
jsPrimitives.includes(typeText.replace("[]", "").toLowerCase()))) {
return typeText;
}
if (typeText.startsWith("Array<")) {
return typeText.replace("Array<", "I").replace(">", "");
}
if (typeText.startsWith("{")) {
return typeText;
}
if (typeText && !typeText.startsWith("I")) {
return `I${typeText}`;
}
return typeText;
}
//# sourceMappingURL=index.js.map