dschnelldavis / parse-full-name

A function that accepts the full name of a person in any format, parses it, and returns its parts { title, first name, middle name, last name, nickname, suffix, [and any parsing errors] }.
74 stars 15 forks source link

Last Name becomes Middle Name with trailing blankspace #2

Open GregZoeller opened 7 years ago

GregZoeller commented 7 years ago

a name such as Ezekiel Johnson would be fine as is and returns { title: '', first: 'Ezekiel', middle: '', last: 'Johnson', nick: '', suffix: '', error: [] }

but Ezekiel Johnsonwith a blank space at the end results in

{ title: '', first: 'Ezekiel', middle: 'Johnson', last: '', nick: '', suffix: '', error: [] }

turbobuilt commented 7 years ago

To fix temporarily you can just do nameStr.trim() before you put it into the function

GregZoeller commented 6 years ago

.replace(/\s\s+/g, ' ').trim()

chris-pardy commented 5 years ago

@GregZoeller @turbobuilt we've taken over ownership of this library I'm moving issues into our fork. Please feel free to comment further on your issue there.