Last active
December 26, 2015 21:39
-
-
Save seidtgeist/7217874 to your computer and use it in GitHub Desktop.
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 couldThrow(hopefullyJSON) { | |
var object = JSON.parse(hopefullyJSON); | |
return Promise.fulfilled(object); | |
} | |
function safe(hopefullyJSON) { | |
return Promise.fulfilled().then(function() { | |
return couldThrow(hopefullyJSON); | |
}); | |
} |
domenic
commented
Oct 29, 2013
Bluebird & JS verbosity argument
partial application:
safe = bluebirdTry jsonParse
js:
var safe = bluebirdTry.bind(null, jsonParse)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment