Skip to content

Commit d2453a8

Browse files
author
cbojar
committed
We should only play with our own toys.
1 parent c747420 commit d2453a8

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎parse-names.js‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ if (!String.prototype.trim) {
88
return this.replace(/^\s+|\s+$/gm, '');
99
};
1010
}
11-
String.prototype.ucfirst = function() {
12-
return this.substr(0,1).toUpperCase() + this.substr(1,this.length - 1).toLowerCase();
13-
};
1411

1512
function NameParse() {}
1613

@@ -177,6 +174,10 @@ NameParse.fix_case = function (word) {
177174
// uppercase words split by the seperator (ex. dashes or periods)
178175
NameParse.safe_ucfirst = function (seperator, word) {
179176
return word.split(seperator).map(function(thisWord){
180-
return this.is_camel_case(thisWord) ? thisWord : thisWord.ucfirst();
177+
if(this.is_camel_case(thisWord)) {
178+
return thisWord;
179+
} else {
180+
return thisWord.substr(0,1).toUpperCase() + thisWord.substr(1).toLowerCase()
181+
}
181182
}, this).join(seperator);
182183
};

0 commit comments

Comments
 (0)