From c4896938eb0e475b6a5c198b337a4e8b69021d0d Mon Sep 17 00:00:00 2001 From: "Jake Lees @brocococonut" Date: Sat, 16 Mar 2024 23:30:39 +1100 Subject: [PATCH] Refactor arrayify function to use flat(1) method --- util/function.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/function.ts b/util/function.ts index f54d0e3..cbacb2e 100644 --- a/util/function.ts +++ b/util/function.ts @@ -26,7 +26,7 @@ const addNumbers = (params: unknown[]): number => const arrayify = (b: Any): Any[] => { switch (true) { case isArray(b): - return b; + return b.flat(1); case isString(b): return b.split(" "); case isObject(b): @@ -69,7 +69,7 @@ const FN_BTE: FuncType = ({ value: a, params: p }) => const FN_NBT: FuncType = (opts) => !FN_BT(opts); const FN_NBTE: FuncType = (opts) => !FN_BTE(opts); // Contained in -const FN_IN: FuncType = ({ value: a, params: [b] }) => +const FN_IN: FuncType = ({ value: a, params: b }) => arrayify(b).includes(a); const FN_NIN: FuncType = (opts) => !FN_IN(opts); // All truthy