improve first name parser by adding honorific exclusions (#2732)

This commit is contained in:
Shelley Vohr 2016-08-17 10:14:38 -07:00 committed by Jackie Luo
parent f7f5c2538f
commit ddbf96a606

View file

@ -146,9 +146,9 @@ class Contact extends Model
return @_nameParts().join(' ')
firstName: ->
articles = ['a', 'the']
exclusions = ['a', 'the', 'dr.', 'mrs.', 'mr.', 'mx.', 'prof.', 'ph.d.']
for part in @_nameParts()
if part.toLowerCase() not in articles
if part.toLowerCase() not in exclusions
return part
return ""