Skip to content

uptown/result.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Result.js

  • A Typescript implementation of Result in Kotlin.

Getting Started

npm

npm i @leejuyoung/result

yarn

yarn add @leejuyoung/result

Examples

import Result from "@leejuyoung/result";

function doSomething(): Result<string> {
  try {
    return Result.success("success")
  } catch (e) {
    return Result.failure(e)
  }
}


if(doSomething().isSuccess){
  // do Something
}
import Result from "@leejuyoung/result";

async function doSomething(): Promise<Result<string>> {
  await Result.of(async () => {
    try {
      return "success"
    } catch (e) {
      throw e
    }
  })
}


if((await doSomething()).isSuccess){
  // do Something
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors