From: Jérôme Benoit Date: Fri, 24 Feb 2023 15:57:52 +0000 (+0100) Subject: refactor(simulator): avoid branching in empty array helpers X-Git-Tag: v1.1.95~33 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5d0b9ffc3224e4a1a0a00400580094afc2393715;p=e-mobility-charging-stations-simulator.git refactor(simulator): avoid branching in empty array helpers Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index f701cea0..7195ce09 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -223,17 +223,11 @@ export class Utils { } public static isEmptyArray(object: unknown | unknown[]): boolean { - if (Array.isArray(object) && object.length === 0) { - return true; - } - return false; + return Array.isArray(object) && object.length === 0; } public static isNotEmptyArray(object: unknown | unknown[]): boolean { - if (Array.isArray(object) && object.length > 0) { - return true; - } - return false; + return Array.isArray(object) && object.length > 0; } public static isEmptyObject(obj: object): boolean {