From 3835f7197d4f978483f64299d7bc6a81a3f70fc1 Mon Sep 17 00:00:00 2001 From: Pedro Guerrato Date: Thu, 14 Oct 2021 07:05:04 -0300 Subject: [PATCH] Improved general helpers and added their funcs to flume index (sc2079) --- src/index.ts | 1 + src/lib/helpers/general.ts | 6 ++++-- src/lib/helpers/index.ts | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/lib/helpers/index.ts diff --git a/src/index.ts b/src/index.ts index f39369dc..b0c8537e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ export * from './lib/theme' export * from './lib/components' export * from './lib/hooks' +export * from './lib/helpers' diff --git a/src/lib/helpers/general.ts b/src/lib/helpers/general.ts index 7ba94548..9643dbe8 100644 --- a/src/lib/helpers/general.ts +++ b/src/lib/helpers/general.ts @@ -1,7 +1,9 @@ export const isNullOrUndefined = (value: any) => { - return value === undefined || value === null + return value === undefined || value === null || typeof value === 'undefined' } export const isEmpty = (value: any) => { - return value === undefined || value === null || value.trim().length === 0 + return isNullOrUndefined(value) || value.trim().length === 0 } + +export default { isNullOrUndefined, isEmpty } diff --git a/src/lib/helpers/index.ts b/src/lib/helpers/index.ts new file mode 100644 index 00000000..94c91d07 --- /dev/null +++ b/src/lib/helpers/index.ts @@ -0,0 +1 @@ +export * from './general'