Created
June 14, 2015 23:18
-
-
Save cgrinaldi/aa4c283d6fdac767eb25 to your computer and use it in GitHub Desktop.
An example of properly using promises (no deferred!)
This file contains 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 getConfig = function() { | |
var readFile = Q.nfbind(fs.readFile); | |
return readFile(CONFIG_DIR + '/aFile.conf', 'utf-8').then(function(data) { | |
var configJSON = helpers.configStr2JSON(data, true); | |
return configJSON; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment