Created
July 17, 2011 00:41
-
-
Save liammclennan/1086983 to your computer and use it in GitHub Desktop.
Directly resolving dependencies in JavaScript Modules
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
| // I'm calling this an anti-pattern because you cannot test this module | |
| // without also testing the 'fs' module or monkey patching the require function. | |
| var fs = require('fs'); | |
| exports.myObject = { | |
| action: function() { | |
| return fs.read('foo'); | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment