Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let value;
let state = iterator.next();
while (!state.done) {
value = yield state.value.run.chain((either) => {
if (either.isLeft()) {
return Future.reject(either.left());
}
return Future.of(either.right());
});
state = iterator.next(value);
}
return Either.of(state.value);
})
);
function MonetEitherT(monad, isRightValue = true) {
if (isUndefined(new.target)) {
if (isNotNull(FlutureTMonetEither) && isFuture(monad)) {
return FlutureTMonetEither.fromFuture(monad);
} else if (monad instanceof Identity.fn.init) {
return Either.of(monad.get());
} else if (monad instanceof Either.fn.init && isNotNull(FlutureTMonetEither)) {
return FlutureTMonetEither.fromEither(monad);
}
return new MonetEitherT(monad);
}
this.run = monad;
this.isRightValue = isRightValue;
}