From: Jérôme Benoit Date: Mon, 2 May 2022 10:49:38 +0000 (+0200) Subject: Use ternary operator in helpers methods X-Git-Tag: v1.1.59~13 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7558b3a6127e4c0541737e24a05c43a006d603c9;p=e-mobility-charging-stations-simulator.git Use ternary operator in helpers methods Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 074b1073..5035efdb 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -161,10 +161,7 @@ export default class Utils { } public static isIterable(obj: T): boolean { - if (obj) { - return typeof obj[Symbol.iterator] === 'function'; - } - return false; + return obj ? typeof obj[Symbol.iterator] === 'function' : false; } public static isString(value: unknown): boolean { @@ -180,11 +177,8 @@ export default class Utils { } public static isNullOrUndefined(value: unknown): boolean { - // eslint-disable-next-line no-eq-null, eqeqeq - if (value == null) { - return true; - } - return false; + // eslint-disable-next-line eqeqeq, no-eq-null + return value == null ? true : false; } public static isEmptyArray(object: unknown): boolean {