0.2.2 • Published 3 years ago

fp-either v0.2.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

fp-either

import { Either, isLeft } from 'fp-either'
import { User } from './User'

const findUser = async (userId: number): Promise<Either<Error | User>> => {
    ...
}

const main = async () => {
  const foundUserOrError = await findUser(1)
  if (isLeft(foundUserOrError)) {
      const error = foundUserOrError.left
      return error
  }
  const foundUser = foundUserOrError.right
  ...
}
0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago