-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix node imports and remove exposed mightFailFunction
- Loading branch information
1 parent
6a0b148
commit 1f6306a
Showing
11 changed files
with
71 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,5 +67,4 @@ course: | |
filePath: /jsdocs/functions/Might.mdx | ||
slug: /functions/Might | ||
type: documentation | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
import { type Either } from "./Either" | ||
import { mightFail, mightFailSync, mightFailFunction, Might, Fail } from "./mightFail" | ||
import { mightFail, mightFailSync, Might, Fail } from "./mightFail" | ||
import { makeMightFail, makeMightFailSync } from "./makeMightFail" | ||
|
||
export { Either, mightFail, makeMightFail, mightFailSync, makeMightFailSync, mightFailFunction, Might, Fail } | ||
export default { mightFail, makeMightFail, mightFailSync, makeMightFailSync, mightFailFunction, Might, Fail } | ||
export { Either, mightFail, makeMightFail, mightFailSync, makeMightFailSync, Might, Fail } | ||
const defaultExport = { | ||
mightFail, | ||
makeMightFail, | ||
mightFailSync, | ||
makeMightFailSync, | ||
Might, | ||
Fail | ||
} | ||
export default defaultExport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { type Either } from "../Either" | ||
import { handleError } from "./errors" | ||
import { createEither } from "./createEither" | ||
import { MightFailFunction } from "./utils.type" | ||
|
||
export const mightFailFunction: MightFailFunction<"standard"> = async function <T>( | ||
promise: Promise<T> | ||
): Promise<Either<T>> { | ||
try { | ||
const result = await promise | ||
return createEither<T>({ result, error: undefined }) | ||
} catch (err) { | ||
const error = handleError(err) | ||
return createEither<T>({ error, result: undefined }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters