Skip to content

saroamirkhanyan/either-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Usage

import * as E from './either';


const log = (x: number): E.Either<string, number> => {
  if (x < 0) return E.left('X cannot be negative');
  return E.right(Math.log(x));
};

console.log(
  E.match(
    (err) => `Error is ${err}`,
    (value) => `Result is ${value}`
  )(log(12))
);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published