Created
September 16, 2014 22:16
-
-
Save nnance/3133d1b05831b8e78005 to your computer and use it in GitHub Desktop.
CommonJS: require() and exports
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
// package/lib is a dependency we require | |
var lib = require('package/lib'); | |
// some behaviour for our module | |
function foo(){ | |
lib.log('hello world!'); | |
} | |
// export (expose) foo to other modules | |
exports.foo = foo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment