aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/follows.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/follows.ts')
-rw-r--r--server/helpers/custom-validators/follows.ts30
1 files changed, 0 insertions, 30 deletions
diff --git a/server/helpers/custom-validators/follows.ts b/server/helpers/custom-validators/follows.ts
deleted file mode 100644
index 0bec683c1..000000000
--- a/server/helpers/custom-validators/follows.ts
+++ /dev/null
@@ -1,30 +0,0 @@
1import { exists, isArray } from './misc'
2import { FollowState } from '@shared/models'
3
4function isFollowStateValid (value: FollowState) {
5 if (!exists(value)) return false
6
7 return value === 'pending' || value === 'accepted' || value === 'rejected'
8}
9
10function isRemoteHandleValid (value: string) {
11 if (!exists(value)) return false
12 if (typeof value !== 'string') return false
13
14 return value.includes('@')
15}
16
17function isEachUniqueHandleValid (handles: string[]) {
18 return isArray(handles) &&
19 handles.every(handle => {
20 return isRemoteHandleValid(handle) && handles.indexOf(handle) === handles.lastIndexOf(handle)
21 })
22}
23
24// ---------------------------------------------------------------------------
25
26export {
27 isFollowStateValid,
28 isRemoteHandleValid,
29 isEachUniqueHandleValid
30}