impress-2020/src/server/util.js
Matt Dunn-Rankin 1bf33c14db use compressed validPetPoses to save network
it also has valid emotion/gp data in there too, which we'll use later!
2020-05-03 01:52:39 -07:00

29 lines
705 B
JavaScript

function capitalize(str) {
return str[0].toUpperCase() + str.slice(1);
}
function getEmotion(moodId) {
if (String(moodId) === "1") {
return "HAPPY";
} else if (String(moodId) === "2") {
return "SAD";
} else if (String(moodId) === "4") {
return "SICK";
} else if (moodId === null) {
return null;
} else {
throw new Error(`unrecognized moodId ${JSON.stringify(moodId)}`);
}
}
function getGenderPresentation(modelPetWasFemale) {
if (String(modelPetWasFemale) === "1") {
return "FEMININE";
} else if (String(modelPetWasFemale) === "0") {
return "MASCULINE";
} else {
return null;
}
}
module.exports = { capitalize, getEmotion, getGenderPresentation };