File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 93
93
"lastName" : "Williams" ,
94
94
"suffix" : ""
95
95
}
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
+ }
96
123
} ] ;
97
124
98
125
test ( 'Test names' , function ( ) {
Original file line number Diff line number Diff line change @@ -60,7 +60,10 @@ var NameParse = (function(){
60
60
// move on to parsing the last name if we find an indicator of a compound last name (Von, Van, etc)
61
61
// we do not check earlier to allow for rare cases where an indicator is actually the first name (like "Von Fabella")
62
62
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
+ }
64
67
}
65
68
66
69
if ( this . is_initial ( word ) ) {
You can’t perform that action at this time.
0 commit comments