Skip to content

Commit

Permalink
FIX: Rename function to callback in trySync
Browse files Browse the repository at this point in the history
  • Loading branch information
ahme-dev committed Jun 1, 2023
1 parent e8b5423 commit 4339596
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ export async function tryAsync<T>(promise: Promise<T>): Promise<Result<T>> {

/**
*
* Function that takes in a function and catches errors in it.
* Function that takes in a callback and catches errors in it.
* Collects either the value or the error in a **_Result_** type.
*
* @param func any function that can throw
* @param callback any function that can throw
* @returns a **_Result_** type
*
*/
export function trySync<T>(func: () => T): Result<T> {
export function trySync<T>(callback: () => T): Result<T> {
try {
const ok = func();
const ok = callback();
return ok;
} catch (err) {
return err as Error;
Expand Down

0 comments on commit 4339596

Please sign in to comment.