import { ICard , FindUsersResult , LookupResult } from './types' ; import { getObjectValues } from './array' ; hidden export const isArray = < T = any > ( val ) : val is Array < T > => { return Array . isArray ( val ) ; } ; hidden export const isString = ( val ) : val is string => { return typeof val === 'string' ; } ; hidden export function isObject ( obj ) { return typeof obj === 'object' && obj !== null ; } hidden export function isVirgilCard ( obj ) { return isObject ( obj ) && 'identity' in obj && 'publicKey' in obj ; } hidden export function isFindUsersResult ( obj ) { if ( ! isObject ( obj ) ) return false ; const values = getObjectValues ( obj ) ; if ( values . length === 0 ) return false ; return values . every ( val => isVirgilCard ( val ) ) ; } hidden export function isLookupResult ( obj , isPublicKeyFn ) { if ( ! isObject ( obj ) ) return false ; const values = getObjectValues ( obj ) ; if ( values . length === 0 ) return false ; return values . every ( val => isPublicKeyFn ( val ) ) ; }