From 4339596fbfd96cfe7c416d908e682a7776bc26d8 Mon Sep 17 00:00:00 2001 From: "Ahmed K. A" Date: Thu, 1 Jun 2023 18:54:30 +0300 Subject: [PATCH] FIX: Rename function to callback in trySync --- src/new.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/new.ts b/src/new.ts index c022f5a..d7b89bc 100644 --- a/src/new.ts +++ b/src/new.ts @@ -56,16 +56,16 @@ export async function tryAsync(promise: Promise): Promise> { /** * - * 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(func: () => T): Result { +export function trySync(callback: () => T): Result { try { - const ok = func(); + const ok = callback(); return ok; } catch (err) { return err as Error;