import { Predicate, Static } from '../types' import { isMap } from '../predicates/isMap' export const map = , U extends Predicate>(keyPredicate: T, valuePredicate: U): Predicate, Static>> => ( value: unknown, ): value is Map, Static> => { let isValid = isMap(value) if (isValid) { for (const [key, entry] of value as Map) { isValid = keyPredicate(key) && valuePredicate(entry) if (!isValid) { break } } } return isValid }