diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-03 14:23:55 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-03 14:23:55 +0100 |
commit | dd6d2a7ce50e7ff02e00995ccc87f8f929ad9709 (patch) | |
tree | b71ed391c2d8f99bff40dd3461010876de7bb23c /shared | |
parent | d324756edb836672f12284cd18e642a658b273d8 (diff) | |
download | PeerTube-dd6d2a7ce50e7ff02e00995ccc87f8f929ad9709.tar.gz PeerTube-dd6d2a7ce50e7ff02e00995ccc87f8f929ad9709.tar.zst PeerTube-dd6d2a7ce50e7ff02e00995ccc87f8f929ad9709.zip |
Improve advanced input filter
Diffstat (limited to 'shared')
-rw-r--r-- | shared/core-utils/utils/array.ts | 13 | ||||
-rw-r--r-- | shared/core-utils/utils/index.ts | 1 |
2 files changed, 14 insertions, 0 deletions
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 @@ | |||
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 | } | ||
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 @@ | |||
1 | export * from './array' | ||
1 | export * from './object' | 2 | export * from './object' |