Skip to content

Commit

Permalink
add isSuccess & isFailure for result
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-ba committed Aug 22, 2023
1 parent 9aef5b5 commit 360521c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fnxt",
"version": "1.15.1",
"version": "1.15.2",
"description": "Functional Extensions for modern JavaScript",
"main": "./dist/cjs/index.js",
"module": "./dist/esm5/index.js",
Expand Down
2 changes: 2 additions & 0 deletions src/result/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ export const Failure = <E>(value: E): FailureType<E> => ({
type: ResultType.Failure,
value,
});
export const isSuccess = <S, F>(result: Result<S, F>): result is SuccessType<S> => result.type === ResultType.Success
export const isFailure = <S, F>(result: Result<S, F>): result is FailureType<F> => result.type === ResultType.Failure

0 comments on commit 360521c

Please sign in to comment.