2020-04-25 04:33:05 -07:00
|
|
|
function capitalize(str) {
|
|
|
|
return str[0].toUpperCase() + str.slice(1);
|
|
|
|
}
|
|
|
|
|
2020-05-02 22:32:08 -07:00
|
|
|
function getEmotion(moodId) {
|
2020-05-03 01:04:34 -07:00
|
|
|
const moodIdStr = String(moodId);
|
|
|
|
if (moodIdStr === "1") {
|
2020-05-02 22:32:08 -07:00
|
|
|
return "HAPPY";
|
2020-05-03 01:04:34 -07:00
|
|
|
} else if (moodIdStr === "2") {
|
2020-05-02 22:32:08 -07:00
|
|
|
return "SAD";
|
2020-05-03 01:04:34 -07:00
|
|
|
} else if (moodIdStr === "4") {
|
2020-05-02 22:32:08 -07:00
|
|
|
return "SICK";
|
2020-05-03 01:04:34 -07:00
|
|
|
} else if (moodIdStr === null) {
|
2020-05-02 22:32:08 -07:00
|
|
|
return null;
|
|
|
|
} else {
|
|
|
|
throw new Error(`unrecognized moodId ${JSON.stringify(moodId)}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getGenderPresentation(modelPetWasFemale) {
|
2020-05-03 01:04:34 -07:00
|
|
|
const modelPetWasFemaleStr = String(modelPetWasFemale);
|
|
|
|
if (modelPetWasFemaleStr === "1") {
|
2020-05-02 22:32:08 -07:00
|
|
|
return "FEMININE";
|
2020-05-03 01:04:34 -07:00
|
|
|
} else if (modelPetWasFemaleStr === "0") {
|
2020-05-02 22:32:08 -07:00
|
|
|
return "MASCULINE";
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = { capitalize, getEmotion, getGenderPresentation };
|