I am looking to assign as an object a Fetch API promise from a local GeoJSON file. Here is the code
fetch("data/sites.geojson")
        .then(function(response) {
            return response.json();
        })
        .then(function(data) {
            L.geoJSON(data, {
                pointToLayer: styles_sites
            }).addTo(map);
        });
    };
I tried the call back method, as advised here Saving fetched JSON into variable
(EDIT) New code, but there is still a missing formal parameter
function getData("data/sites.geojson", cb) {
fetch("data/sites.geojson")
    .then(function(response) {
        return response.json();
    })
    .then(function(data) {
        L.geoJSON(data, {
            pointToLayer: styles_sites,
            onEachFeature: function (feature, layer) {
                layer.on('mouseover', function() { 
                    layer.openPopup(layer.bindPopup("<b>"+feature.properties.nombre+"</b>"))
                });
                layer.on('mouseout', function() { 
                    layer.closePopup(); 
                });
                layer.on('click', function () {
                    layer.bindPopup("<b>Nombre: </b>"+feature.properties.nombre+"<br><b>Barrio: </b>"+feature.properties.barrio+"<br><b>Tipo: </b>"+feature.properties.tipo+"<br><b>Ubicacion: </b>"+feature.properties.ubicacion+"<br><b>Correo: </b>"+feature.properties.contacto);
                });
            }
        }).addTo(map);
    .then(function(result) {
        cb(result);
        });
    });
};
getData("data/sites.geojson", function (data) {
    return console.log({data});
});
 
     
    