Last active
December 29, 2015 16:36
-
-
Save brianswisher/f1cb12fdd2ba789bbcf0 to your computer and use it in GitHub Desktop.
Capitalize Utililty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require("./util.js"); | |
console.log(util.capitalize("hello")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(name){ | |
if (typeof exports === "undefined"){ | |
if (!this[name]) this[name] = {} | |
this.exports = this[name]; | |
} | |
}("util") | |
exports.capitalize = function(str){ | |
/* assumption: can use ES6 template strings */ | |
return `${str.charAt(0).toUpperCase()}${str.slice(1)}` | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
util.js
is isomorphic.