Skip to content

Commit

Permalink
Merge pull request #43 from zewa666/utils
Browse files Browse the repository at this point in the history
feat(utils): add utils
  • Loading branch information
zewa666 committed May 11, 2015
2 parents 4c2a4d5 + dd08635 commit 8f5d00e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function ucFirst(val) {
return val.charAt(0).toUpperCase() + val.slice(1);
}

function toCamelCase(str) {
if(str) {
return str
.replace(/\s(.)/g, function($1) { return $1.toUpperCase(); })
.replace(/\s/g, '')
.replace(/^(.)/, function($1) { return $1.toLowerCase(); });
}
}

module.exports = {
ucFirst: ucFirst,
toCamelCase: toCamelCase
};

0 comments on commit 8f5d00e

Please sign in to comment.