Closed kadiryazici closed 2 years ago
Well, you might kick yourself - but this is built in: Result.safe
.
There are a couple of differences between the implementations, so I'd suggest checking out the docs for safe: https://www.npmjs.com/package/oxide.ts#safe
@traverse1984 sorry my bad 😢 I should read carefully thanks.
No worries... appreciate your interest and you made a good implementation. Nice work.
We have
Result.from
but what if We want to use callback and use it's exception as Error and return value as Ok also it supports Promise, this method provides it.I was using this method in my projects and it was really helpful while working with Promises or Exceptions, I thought that it would be nice if library includes this method.
Example