Skip to content

Instantly share code, notes, and snippets.

@dimitris-papadimitriou-chr
Created September 14, 2019 10:24
Show Gist options
  • Save dimitris-papadimitriou-chr/f3555fef19da80d083db302436e52d83 to your computer and use it in GitHub Desktop.
Save dimitris-papadimitriou-chr/f3555fef19da80d083db302436e52d83 to your computer and use it in GitHub Desktop.
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