Skip to content

Commit c32bb04

Browse files
author
cbojar
committed
Fix up the code a bit.
-Prefer === over == -Put in ()s around return boolean test to match rest of code -Don't lose your trailing ;s
1 parent affe050 commit c32bb04

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

parse-names.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,17 @@ var NameParse = (function(){
105105
NameParse.is_salutation = function (word) {
106106
word = this.removeIgnoredChars(word).toLowerCase();
107107
// returns normalized values
108-
if (word == "mr" || word == "master" || word == "mister") {
108+
if (word === "mr" || word === "master" || word === "mister") {
109109
return "Mr.";
110-
} else if (word == "mrs") {
110+
} else if (word === "mrs") {
111111
return "Mrs.";
112-
} else if (word == "miss" || word == "ms") {
112+
} else if (word === "miss" || word === "ms") {
113113
return "Ms.";
114-
} else if (word == "dr") {
114+
} else if (word === "dr") {
115115
return "Dr.";
116-
} else if (word == "rev") {
116+
} else if (word === "rev") {
117117
return "Rev.";
118-
} else if (word == "fr") {
118+
} else if (word === "fr") {
119119
return "Fr.";
120120
} else {
121121
return false;
@@ -149,13 +149,13 @@ var NameParse = (function(){
149149
word = word.toLowerCase();
150150
// these are some common prefixes that identify a compound last names - what am I missing?
151151
var words = ['vere','von','van','de','del','della','di','da','pietro','vanden','du','st.','st','la','lo','ter'];
152-
return words.indexOf(word) >= 0;
152+
return (words.indexOf(word) >= 0);
153153
};
154154

155155
// single letter, possibly followed by a period
156156
NameParse.is_initial = function (word) {
157157
word = this.removeIgnoredChars(word);
158-
return (word.length == 1);
158+
return (word.length === 1);
159159
};
160160

161161
// detect mixed case words like "McDonald"
@@ -183,7 +183,7 @@ var NameParse = (function(){
183183
if(this.is_camel_case(thisWord)) {
184184
return thisWord;
185185
} else {
186-
return thisWord.substr(0,1).toUpperCase() + thisWord.substr(1).toLowerCase()
186+
return thisWord.substr(0,1).toUpperCase() + thisWord.substr(1).toLowerCase();
187187
}
188188
}, this).join(seperator);
189189
};

0 commit comments

Comments
 (0)