1 import { exists, isArray } from './misc'
2 import { FollowState } from '@shared/models'
4 function isFollowStateValid (value: FollowState) {
5 if (!exists(value)) return false
7 return value === 'pending' || value === 'accepted'
10 function isRemoteHandleValid (value: string) {
11 if (!exists(value)) return false
12 if (typeof value !== 'string') return false
14 return value.includes('@')
17 function isEachUniqueHandleValid (handles: string[]) {
18 return isArray(handles) &&
19 handles.every(handle => {
20 return isRemoteHandleValid(handle) && handles.indexOf(handle) === handles.lastIndexOf(handle)
24 // ---------------------------------------------------------------------------
29 isEachUniqueHandleValid