Skip to content
Discussion options

You must be logged in to vote

@Wheatgrh Yes, sure. Sorry for the late reply.
The keys to the async operations are the static chain function and instance asyncChain function, so I see that the usage of the described functions would look like this:

import { chain } from '@sweet-monads/either';
import type { Either } from '@sweet-monads/either';

// First variant with the static `chain` function
function resizeImageFile(maybeImage: Express.Multer.File): Promise<Either<Error, sharp.Sharp>> {
  return _convertImage(maybeImage)
    .then(chain(image => _resizeImage(image, expectedSize)))
}

// Second variant with the `chainAsync` function
async function resizeImageFile(maybeImage: Express.Multer.File): Promise<Either<Error, s…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Wheatgrh
Comment options

@JSMonk
Comment options

Answer selected by Wheatgrh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants