From a1c7be94d6d98be56a8f7ec5785a5ba05f31f21e Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Tue, 18 Apr 2023 00:17:02 -0400 Subject: [PATCH] fix(striker-ui-api): add isObject() --- striker-ui-api/src/lib/isObject.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 striker-ui-api/src/lib/isObject.ts diff --git a/striker-ui-api/src/lib/isObject.ts b/striker-ui-api/src/lib/isObject.ts new file mode 100644 index 00000000..caab9fe2 --- /dev/null +++ b/striker-ui-api/src/lib/isObject.ts @@ -0,0 +1,10 @@ +export const isObject = (value: unknown) => { + const result: { is: boolean; obj: object } = { is: false, obj: {} }; + + if (typeof value === 'object' && value !== null) { + result.is = true; + result.obj = value; + } + + return result; +};