From ede4271394f2a702d6a18151b3f0fad44a0a6d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Mon, 12 Feb 2024 11:47:08 +0300 Subject: [PATCH] add new methods --- src/app/components/utils/objectutils.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/components/utils/objectutils.ts b/src/app/components/utils/objectutils.ts index 95d169637d6..d55d17eabd5 100644 --- a/src/app/components/utils/objectutils.ts +++ b/src/app/components/utils/objectutils.ts @@ -1,4 +1,12 @@ export class ObjectUtils { + public static isArray(value, empty = true) { + return Array.isArray(value) && (empty || value.length !== 0); + } + + public static isObject(value, empty = true) { + return value instanceof Object && value.constructor === Object && (empty || Object.keys(value).length !== 0); + } + public static equals(obj1: any, obj2: any, field?: string): boolean { if (field) return this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field); else return this.equalsByValue(obj1, obj2);