Added isEmpty and isNotEmpty methods to ObjectUtils
parent
16c0e43024
commit
605424d3c3
|
@ -202,6 +202,18 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
isEmpty(value) {
|
||||||
|
return (
|
||||||
|
value === null || value === undefined || value === '' ||
|
||||||
|
(Array.isArray(value) && value.length === 0) ||
|
||||||
|
(!(value instanceof Date) && typeof value === 'object' && Object.keys(value).length === 0)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
isNotEmpty(value) {
|
||||||
|
return !this.isEmpty(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -62,6 +62,8 @@ export declare class ObjectUtils {
|
||||||
static contains(value: any, list: any[]): boolean;
|
static contains(value: any, list: any[]): boolean;
|
||||||
static insertIntoOrderedArray(item: any, index: number, arr: any[], sourceArr: any[]): void;
|
static insertIntoOrderedArray(item: any, index: number, arr: any[], sourceArr: any[]): void;
|
||||||
static removeAccents(str: any): string;
|
static removeAccents(str: any): string;
|
||||||
|
static isEmpty(value: any): boolean;
|
||||||
|
static isNotEmpty(value: any): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare namespace ZIndexUtils {
|
export declare namespace ZIndexUtils {
|
||||||
|
|
Loading…
Reference in New Issue