forked from DebaucheryLibrarian/traxxx
Compare commits
1 Commits
minor-refa
...
update-esl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bc276b8da |
1188
package-lock.json
generated
1188
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -48,14 +48,14 @@
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-preset-airbnb": "^5.0.0",
|
||||
"css-loader": "^6.5.0",
|
||||
"eslint": "^8.1.0",
|
||||
"eslint-config-airbnb": "^18.2.1",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint": "^8.2.0",
|
||||
"eslint-config-airbnb": "^19.0.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
||||
"eslint-plugin-react": "^7.18.3",
|
||||
"eslint-plugin-vue": "^8.0.3",
|
||||
"eslint-watch": "^7.0.0",
|
||||
"eslint-watch": "^8.0.0",
|
||||
"eslint-webpack-plugin": "^3.1.0",
|
||||
"mini-css-extract-plugin": "^2.4.3",
|
||||
"node-sass": "^6.0.1",
|
||||
|
||||
@@ -33,7 +33,6 @@ const capitalize = require('./utils/capitalize');
|
||||
const resolvePlace = require('./utils/resolve-place');
|
||||
const { resolveLayoutScraper } = require('./scrapers/resolve');
|
||||
const getRecursiveParameters = require('./utils/get-recursive-parameters');
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
const hairColors = {
|
||||
'jet-black': 'black',
|
||||
@@ -335,32 +334,6 @@ function curateProfileEntry(profile) {
|
||||
return curatedProfileEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Date} birthDate
|
||||
*/
|
||||
function isAdult(birthDate) {
|
||||
return dayjs(birthDate).diff(new Date(), "years") >= 18;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to parse gender from string, or null if not found
|
||||
*
|
||||
* @param {String} text
|
||||
* @returns {String | null}
|
||||
*/
|
||||
function tryParseGender(text) {
|
||||
if (/female/i.test(profile.gender)) {
|
||||
return 'female';
|
||||
}
|
||||
else if (/shemale|trans/i.test(profile.gender)) {
|
||||
return 'transsexual';
|
||||
}
|
||||
else if (/male/i.test(profile.gender)) {
|
||||
return 'male';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function curateProfile(profile, actor) {
|
||||
if (!profile) {
|
||||
return null;
|
||||
@@ -394,12 +367,15 @@ async function curateProfile(profile, actor) {
|
||||
curatedProfile.tattoos = profile.tattoos?.trim() || null;
|
||||
curatedProfile.piercings = profile.piercings?.trim() || null;
|
||||
|
||||
curatedProfile.gender = tryParseGender(profile.gender);
|
||||
curatedProfile.gender = (/female/i.test(profile.gender) && 'female')
|
||||
|| (/shemale|trans/i.test(profile.gender) && 'transsexual')
|
||||
|| (/male/i.test(profile.gender) && 'male')
|
||||
|| null;
|
||||
|
||||
const dateOfBirth = profile.dateOfBirth || profile.birthdate;
|
||||
|
||||
curatedProfile.dateOfBirth = (!Number.isNaN(Number(dateOfBirth)) // possibly valid date
|
||||
&& isAdult(dateOfBirth) // over 18
|
||||
&& new Date() - dateOfBirth > 567648000000 // over 18
|
||||
&& dateOfBirth)
|
||||
|| null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user