-
-
Save dimitris-papadimitriou-chr/f3555fef19da80d083db302436e52d83 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
var EitherAsync = function (actions, g) { | |
this.cata = function (alg) { | |
actions(alg.ok , alg.error) | |
} | |
} | |
Promise.prototype.toEither = function () { | |
var promise = this; | |
var either = new EitherCoyoAsync(function (resolve, reject) { | |
promise.then(resolve).catch(reject) | |
}); | |
return either; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment