Skip to content

Commit ccd7522

Browse files
author
cbojar
committed
Fix is_camel_case regexes.
1 parent 509f358 commit ccd7522

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎parse-names.js‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,10 @@ var NameParse = (function(){
155155

156156
// detect mixed case words like "McDonald"
157157
// returns false if the string is all one case
158-
// FIXME: No it doesn't. It returns true so long as there is a letter in the string, or if it's empty
159-
// FIXME: Also this does not take in to account the first letter being capitalized
160158
NameParse.is_camel_case = function (word) {
161-
var ucReg = /|[A-Z]+|s/;
162-
var lcReg = /|[a-z]+|s/;
163-
return (word.match(ucReg) != null && word.match(lcReg) != null);
159+
var ucReg = /[A-Z]+/;
160+
var lcReg = /[a-z]+/;
161+
return (ucReg.exec(word) && lcReg.exec(word));
164162
};
165163

166164
// ucfirst words split by dashes or periods

0 commit comments

Comments
 (0)