Skip to content

Commit

Permalink
tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
Inalegwu committed Sep 16, 2024
1 parent 65918ae commit 780e5d7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ const unsafeDivide = (a: number, b: number) => {
const safeDivide = makeSafeFunction(unsafeDivide);

safeDivide(1, 2).match(console.log, console.error);
safeDivide(1, 0).match(console.log, console.error);
const zeroDiv = safeDivide(1, 0);

if (zeroDiv.isOk()) {
console.log(zeroDiv.value);
} else {
console.log(`IT HAPPENED::${zeroDiv.error}`);
}

0 comments on commit 780e5d7

Please sign in to comment.