diff options
Diffstat (limited to 'shared/core-utils/common/array.ts')
-rw-r--r-- | shared/core-utils/common/array.ts | 10 |
1 files changed, 9 insertions, 1 deletions
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 <T> (array1: T[], array2: T[]) { | |||
8 | return null | 8 | return null |
9 | } | 9 | } |
10 | 10 | ||
11 | // Avoid conflict with other toArray() functions | ||
12 | function arrayify <T> (element: T | T[]) { | ||
13 | if (Array.isArray(element)) return element | ||
14 | |||
15 | return [ element ] | ||
16 | } | ||
17 | |||
11 | export { | 18 | export { |
12 | findCommonElement | 19 | findCommonElement, |
20 | arrayify | ||
13 | } | 21 | } |