Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
} else if (["address", "add"].includes(extractor)) {
result = addressit(data)
} else if (["email", "mail", "@"].includes(extractor)) {
if (multiple) {
result = data.match(emailRegex) || data
if (_.isArray(result) && result.length === 1) {
result = result[0]
}
} else {
result = data.match(emailRegex) !== null ? data.match(emailRegex)[0] : ""
}
} else if (["date", "d"].includes(extractor)) {
let date = chrono.casual.parseDate(data)
if (date) {
result = date.toString()
} else {
result = ""
}
} else if (["fullName", "prenom", "firstName", "nom", "lastName", "initials", "suffix", "salutation"].includes(extractor)) {
// compact data before to parse it
result = humanname.parse(filterData(data, "cmp"))
if ("fullName".includes(extractor)) {
// return the object
} else if (["firstName", "prenom"].includes(extractor)) {
result = result.firstName
} else if (["lastName", "nom"].includes(extractor)) {
result = result.lastName
} else if ("initials".includes(extractor)) {
result = result.initials
}
}
} else if (["address", "add"].includes(extractor)) {
result = addressit(data)
} else if (["email", "mail"].includes(extractor)) {
if (multiple) {
result = data.match(emailRegex) || data
if (_.isArray(result) && result.length === 1) {
result = result[0]
}
} else {
result = data.match(emailRegex) !== null ? data.match(emailRegex)[0] : ""
}
} else if (["date", "d"].includes(extractor)) {
let date = chrono.casual.parseDate(data)
if (date) {
result = date.toString()
} else {
result = ""
}
} else if (["fullName", "prenom", "firstName", "nom", "lastName", "initials", "suffix", "salutation"].includes(extractor)) {
// compact data before to parse it
result = humanname.parse(filterData(data, "cmp"))
if ("fullName".includes(extractor)) {
// return the object
} else if (["firstName", "prenom"].includes(extractor)) {
result = result.firstName
} else if (["lastName", "nom"].includes(extractor)) {
result = result.lastName
} else if ("initials".includes(extractor)) {
result = result.initials