From 5d0b9ffc3224e4a1a0a00400580094afc2393715 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 24 Feb 2023 16:57:52 +0100 Subject: [PATCH] refactor(simulator): avoid branching in empty array helpers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/utils/Utils.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) 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 { -- 2.34.1