import { filter , includes , reject } from "lodash" ; interface WithName { name : string ; } export function filterMembersByPrefix < T extends WithName > ( members , prefix ) { return filter ( members , ( _ ) => _ . name . includes ( prefix ) ) ; } export function filterMembersByNames < T extends WithName > ( members , preExistingNames ) { return reject ( members , ( _ ) => includes ( preExistingNames , _ . name ) ) ; } export function filterMembersForSuggestion < T extends WithName > ( members , prefix , preExistingNames ) { const filteredMembersByPrefix = filterMembersByPrefix ( members , prefix ) ; return filterMembersByNames ( filteredMembersByPrefix , preExistingNames ) ; }