JavaScript-Name-Parser icon indicating copy to clipboard operation
JavaScript-Name-Parser copied to clipboard

Does not work for last name Ma

Open barrett-vegas-com opened this issue 7 years ago • 2 comments

Jack Ma is parsed as first name Jack and suffix MA, no last name.

barrett-vegas-com avatar Mar 15 '18 15:03 barrett-vegas-com

Yeah, it's a suffix for Master of Arts. You could remove it from the suffixArray.

eljeffeg avatar Mar 15 '18 15:03 eljeffeg

A check could be added that if the last name is empty but a suffix is found, maybe ignore the suffix assignment. Also could check to see if it's mixed case as normally it would be written as MA.

Maybe something like this toward the end.

    if (suffix !== "" && lastName === "") {
        suffix = "";
        lastName = nameParts[numWords - 1];
    }

eljeffeg avatar Mar 15 '18 15:03 eljeffeg