diff options
Diffstat (limited to 'shared/core-utils/common/array.ts')
-rw-r--r-- | shared/core-utils/common/array.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/shared/core-utils/common/array.ts b/shared/core-utils/common/array.ts new file mode 100644 index 000000000..9e326a5aa --- /dev/null +++ b/shared/core-utils/common/array.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | function findCommonElement <T> (array1: T[], array2: T[]) { | ||
2 | for (const a of array1) { | ||
3 | for (const b of array2) { | ||
4 | if (a === b) return a | ||
5 | } | ||
6 | } | ||
7 | |||
8 | return null | ||
9 | } | ||
10 | |||
11 | export { | ||
12 | findCommonElement | ||
13 | } | ||