}
public static validateUUID(uuid: string): boolean {
- return /\/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$\/i/.test(uuid);
+ return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
+ uuid
+ );
}
public static async sleep(milliSeconds: number): Promise<NodeJS.Timeout> {
}
public static isEmptyArray(object: unknown): boolean {
- if (!object) {
- return true;
+ if (!Array.isArray(object)) {
+ return false;
}
- if (Array.isArray(object) === true && (object as unknown[]).length > 0) {
+ if ((object as unknown[]).length > 0) {
return false;
}
return true;
}
public static isEmptyObject(obj: object): boolean {
- if (obj.constructor !== Object) {
+ if (obj?.constructor !== Object) {
return false;
}
// Iterates over the keys of an object, if