Skip to content

Commit 7cf29b8

Browse files
authored
Merge pull request #15 from jeffg2k/master
Compound LN - one letter and capitalized -> initial
2 parents 6ab9546 + 9d52b0b commit 7cf29b8

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

Diff for: parse-names-test.html

+27
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,33 @@
9393
"lastName": "Williams",
9494
"suffix": ""
9595
}
96+
}, {
97+
name: "Jack O'Neill",
98+
result: {
99+
"salutation": "",
100+
"firstName": "Jack",
101+
"initials": "",
102+
"lastName": "O'Neill",
103+
"suffix": ""
104+
}
105+
}, {
106+
name: "Jack o Neill",
107+
result: {
108+
"salutation": "",
109+
"firstName": "Jack",
110+
"initials": "",
111+
"lastName": "O Neill",
112+
"suffix": ""
113+
}
114+
}, {
115+
name: "Jack O Neill",
116+
result: {
117+
"salutation": "",
118+
"firstName": "Jack",
119+
"initials": "O",
120+
"lastName": "Neill",
121+
"suffix": ""
122+
}
96123
}];
97124

98125
test('Test names', function() {

Diff for: parse-names.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ var NameParse = (function(){
6060
// move on to parsing the last name if we find an indicator of a compound last name (Von, Van, etc)
6161
// we do not check earlier to allow for rare cases where an indicator is actually the first name (like "Von Fabella")
6262
if (this.is_compound_lastName(word)) {
63-
break;
63+
if (!(this.is_initial(word) && word === word.toUpperCase())) {
64+
//If it's one letter and capitalized, consider it a middle initial
65+
break;
66+
}
6467
}
6568

6669
if (this.is_initial(word)) {

0 commit comments

Comments
 (0)