From e3d6c6434f570f77c0532f86c82f78bcafb399ec Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 27 Jul 2022 13:44:40 +0200 Subject: Add bulk action on following/followers --- shared/core-utils/common/array.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'shared') diff --git a/shared/core-utils/common/array.ts b/shared/core-utils/common/array.ts index 9e326a5aa..95393c731 100644 --- a/shared/core-utils/common/array.ts +++ b/shared/core-utils/common/array.ts @@ -8,6 +8,14 @@ function findCommonElement (array1: T[], array2: T[]) { return null } +// Avoid conflict with other toArray() functions +function arrayify (element: T | T[]) { + if (Array.isArray(element)) return element + + return [ element ] +} + export { - findCommonElement + findCommonElement, + arrayify } -- cgit v1.2.3