From dd6d2a7ce50e7ff02e00995ccc87f8f929ad9709 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Nov 2021 14:23:55 +0100 Subject: Improve advanced input filter --- shared/core-utils/utils/array.ts | 13 +++++++++++++ shared/core-utils/utils/index.ts | 1 + 2 files changed, 14 insertions(+) create mode 100644 shared/core-utils/utils/array.ts (limited to 'shared/core-utils') diff --git a/shared/core-utils/utils/array.ts b/shared/core-utils/utils/array.ts new file mode 100644 index 000000000..9e326a5aa --- /dev/null +++ b/shared/core-utils/utils/array.ts @@ -0,0 +1,13 @@ +function findCommonElement (array1: T[], array2: T[]) { + for (const a of array1) { + for (const b of array2) { + if (a === b) return a + } + } + + return null +} + +export { + findCommonElement +} diff --git a/shared/core-utils/utils/index.ts b/shared/core-utils/utils/index.ts index a71977d88..8d16365a8 100644 --- a/shared/core-utils/utils/index.ts +++ b/shared/core-utils/utils/index.ts @@ -1 +1,2 @@ +export * from './array' export * from './object' -- cgit v1.2.3