function dataByHost(data) {
    var hosts = hostsFromData(data);
    var result = {}
    hosts.forEach(hostName => {
        result[hostName] = data.sites.filter(site => site.host === hostName)
            .sort((a, b) => a.name.localeCompare(b.name));
    });
    return result;
}
/**
 * Restructure the data to a map where the key is the host(name) and the value
 * the list of sites (sorted alphabetical) that belong to that host.
 */
Restructure the data to a map where the key is the host(name) and the value
the list of sites (sorted alphabetical) that belong to that host.
Restructure the data to a map where the key is the host ( name ) and the value the list of sites ( sorted alphabetical ) that belong to that host .
function dataByHost(data) {
    var hosts = hostsFromData(data);
    var result = {}
    hosts.forEach(hostName => {
        result[hostName] = data.sites.filter(site => site.host === hostName)
            .sort((a, b) => a.name.localeCompare(b.name));
    });
    return result;
}
function dataByHost ( data ) { var hosts = hostsFromData ( data ) ; var result = { } hosts . forEach ( hostName => { result [ hostName ] = data . sites . filter ( site => site . host === hostName ) . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ; } ) ; return result ; }
Restructure the data to a map where the key is the host(name) and the value
 the list of sites (sorted alphabetical) that belong to that host.
Restructure the data to a map where the key is the host ( name ) and the value the list of sites ( sorted alphabetical ) that belong to that host .