X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FUtils.ts;h=6557a588446455506656c7f7133e8fe85c5881f0;hb=b40b5cb39eb44088100f2ce5efc2a6fdf4b84f26;hp=4a9bdb709a2ab8c530a18e2aaa4b41a2d452342c;hpb=8475b2228f0b36777e1a9528b2d61348facad82f;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 4a9bdb70..6557a588 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -26,7 +26,7 @@ export default class Utils { } public static async sleep(milliSeconds: number): Promise { - return new Promise(resolve => setTimeout(resolve as () => void, milliSeconds)); + return new Promise((resolve) => setTimeout(resolve as () => void, milliSeconds)); } public static formatDurationMilliSeconds(duration: number): string { @@ -184,8 +184,8 @@ export default class Utils { return clone(object); } - public static isIterable(obj: T): boolean { - return obj ? typeof obj[Symbol.iterator] === 'function' : false; + public static isIterable>(obj: T): boolean { + return !Utils.isNullOrUndefined(obj) ? typeof obj[Symbol.iterator] === 'function' : false; } public static isString(value: unknown): boolean { @@ -197,7 +197,7 @@ export default class Utils { } public static isUndefined(value: unknown): boolean { - return typeof value === 'undefined'; + return value === undefined; } public static isNullOrUndefined(value: unknown): boolean {