Created
January 26, 2010 23:48
-
-
Save felixge/287381 to your computer and use it in GitHub Desktop.
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
function loadConfig() { | |
return posix | |
.cat('config.json') | |
(true, function(config) { | |
return (config instanceof Error) | |
? posix.cat('configuration.json') | |
: config; | |
}) | |
(function() { | |
return JSON.parse(config); | |
}) | |
} |
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
function loadConfig() { | |
return posix.cat('config.json') | |
.addErrback(function(err) { | |
return posix.cat('configuration.json'); | |
}) | |
.addCallback(function(config) { | |
return JSON.parse(config); | |
}) | |
.addErrback(function(err) { | |
throw new Error("Can't load config"); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment