Skip to content

Commit

Permalink
add new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetcetin01140 committed Feb 12, 2024
1 parent 4e6110e commit ede4271
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/components/utils/objectutils.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down

0 comments on commit ede4271

Please sign in to comment.