init import projet
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
export type PredictionTheme = "boy" | "girl";
|
||||
|
||||
function normalizeText(value: string) {
|
||||
return value
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.normalize("NFD")
|
||||
.replace(/[\u0300-\u036f]/g, "");
|
||||
}
|
||||
|
||||
export function getThemeFromSexValue(value: string | null | undefined): PredictionTheme | null {
|
||||
if (!value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const normalized = normalizeText(value);
|
||||
|
||||
if (normalized === "fille" || normalized === "girl") {
|
||||
return "girl";
|
||||
}
|
||||
|
||||
if (normalized === "garcon" || normalized === "boy") {
|
||||
return "boy";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user