forked from DebaucheryLibrarian/traxxx
Fixed boolean handling in actor profile curation.
This commit is contained in:
parent
92eed64fe8
commit
a8f68f4993
|
@ -75,8 +75,30 @@ const ethnicities = {
|
|||
white: 'white',
|
||||
};
|
||||
|
||||
function getBoolean(value) {
|
||||
if (typeof value === 'boolean') {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (typeof value === 'string') {
|
||||
if (/yes/i.test(value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (/no/i.test(value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getMostFrequent(items) {
|
||||
const { mostFrequent } = items.reduce((acc, item) => {
|
||||
if (item === undefined || item === null) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
const slug = slugify(item);
|
||||
|
||||
acc.counts[slug] = (acc.counts[slug] || 0) + 1;
|
||||
|
@ -347,25 +369,10 @@ async function curateProfile(profile, actor) {
|
|||
curatedProfile.penisLength = Number(profile.penisLength) || profile.penisLength?.match?.(/\d+/)?.[0] || null;
|
||||
curatedProfile.penisGirth = Number(profile.penisGirth) || profile.penisGirth?.match?.(/\d+/)?.[0] || null;
|
||||
|
||||
curatedProfile.circumcised = (typeof profile.circumcised === 'boolean' && profile.circumcised)
|
||||
?? (/yes/i.test(profile.circumcised) && true)
|
||||
?? (/no/i.test(profile.circumcised) && false)
|
||||
?? null;
|
||||
|
||||
curatedProfile.naturalBoobs = (typeof profile.naturalBoobs === 'boolean' && profile.naturalBoobs)
|
||||
?? (/yes/i.test(profile.naturalBoobs) && true)
|
||||
?? (/no/i.test(profile.naturalBoobs) && false)
|
||||
?? null;
|
||||
|
||||
curatedProfile.hasTattoos = (typeof profile.hasTattoos === 'boolean' && profile.hasTattoos)
|
||||
?? (/yes/i.test(profile.hasTattoos) && true)
|
||||
?? (/no/i.test(profile.hasTattoos) && true)
|
||||
?? null;
|
||||
|
||||
curatedProfile.hasPiercings = (typeof profile.hasPiercings === 'boolean' && profile.hasPiercings)
|
||||
?? (/yes/i.test(profile.hasPiercings) && true)
|
||||
?? (/no/i.test(profile.hasPiercings) && true)
|
||||
?? null;
|
||||
curatedProfile.circumcised = getBoolean(profile.circumcised);
|
||||
curatedProfile.naturalBoobs = getBoolean(profile.naturalBoobs);
|
||||
curatedProfile.hasTattoos = getBoolean(profile.hasTattoos);
|
||||
curatedProfile.hasPiercings = getBoolean(profile.hasPiercings);
|
||||
|
||||
if (argv.resolvePlace) {
|
||||
const [placeOfBirth, placeOfResidence] = await Promise.all([
|
||||
|
|
Loading…
Reference in New Issue