import { HostRule } from '../../types' ; import { findAll } from '../../util/host-rules' ; function isAuthenticatable ( rule ) { return ( ! ! rule . resolvedHost && ( ( ! ! rule . username && ! ! rule . password ) || ! ! rule . token ) ) ; } export function findAllAuthenticatable ( { hostType , } ) { return findAll ( { hostType } ) . filter ( isAuthenticatable ) ; } export function getAuthenticationHeaderValue ( hostRule ) { if ( hostRule . username ) { return `${ hostRule . username }:${ hostRule . password }` ; } return hostRule . token ; }