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

Not parsing properly when name has a dash (-). #30

Open tahaaslam1 opened 7 months ago

tahaaslam1 commented 7 months ago

The functions returns only last in case string is passed B05-1005 In my opinion, it should return return

{
  title: '',
  first: 'B05',
  middle: '-',
  last: '1005',
  nick: '',
  suffix: '',
  error: []
}

Also, is there a way we can choose which part to include in which case by passing preferences?

vinser commented 2 months ago

IMO it works as expected for double-barrelled names. https://en.wikipedia.org/wiki/Double-barrelled_name