import { fetchFromApi } from './api/haveibeenpwned' ; import type { Breach } from './api/haveibeenpwned/types' ; param { string } account param options param { string } options . apiKey param { string } options . domain param { boolean } options . includeUnverified param { boolean } options . truncate param { string } options . baseUrl param { string } options . userAgent returns { ( Promise < Breach [ ] > | Promise < null > ) } example example example export function breachedAccount ( account , options = { includeUnverified : true , truncate : true , } ) { const endpoint = `/breachedaccount/${ encodeURIComponent ( account ) }?` ; const params = [ ] ; if ( options . domain ) { params . push ( `domain=${ encodeURIComponent ( options . domain ) }` ) ; } if ( options . includeUnverified === false ) { params . push ( 'includeUnverified=false' ) ; } if ( options . truncate === false ) { params . push ( 'truncateResponse=false' ) ; } return fetchFromApi ( `${ endpoint }${ params . join ( '&' ) }` , { apiKey : options . apiKey , baseUrl : options . baseUrl , userAgent : options . userAgent , } ) as Promise < Breach [ ] | null > ; }