From 6c9057e5e32a299bae360c08f977d0bba4d39d74 Mon Sep 17 00:00:00 2001 From: Dan Rumney Date: Mon, 6 May 2024 20:12:44 -0500 Subject: [PATCH] feat(utilities): add utility functions to make for cleaner consuming code --- src/utilities.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/utilities.ts diff --git a/src/utilities.ts b/src/utilities.ts new file mode 100644 index 00000000..6c697825 --- /dev/null +++ b/src/utilities.ts @@ -0,0 +1,22 @@ +/** + * This is the identity function - it returns whatever you pass in + */ +export const identity = (t: T) => t +/** + * {@link identity} + */ +export const asIs = identity + +/** + * This function returns undefined, whatever you pass in + */ +export const drop = (t: unknown) => undefined +/** + * {@link drop} + */ +export const asUndefined = drop; + + +export const logError = (e: Error) => { + console.error(e) +} \ No newline at end of file