From 9b6b3bd7d00f156c4903e2ab5ca6ae332b90a9dc Mon Sep 17 00:00:00 2001 From: Angelo Ashmore Date: Thu, 13 Oct 2022 16:04:06 -1000 Subject: [PATCH] refactor: remove unused function --- src/lib/orElseThrow.ts | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 src/lib/orElseThrow.ts diff --git a/src/lib/orElseThrow.ts b/src/lib/orElseThrow.ts deleted file mode 100644 index 8fee3e4c..00000000 --- a/src/lib/orElseThrow.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Throws an error if a given value is nullish. - * - * @typeParam Nullable - Value to check. - * @param a -Nullable value to check. - * @param error - Error to throw if `a` is nullish. - * - * @returns `a`, whose type is narrowed to be non-nullable. - * @throws Throws the given error if `a` is nullish. - */ -export const orElseThrow = (a: T | null | undefined, error: Error): T => { - if (a == null) { - throw error; - } - - return a; -};