src/collectionTools.js
//document and data:object with the data to pass to the document.update
document and data:object with the data to pass to the document.update
document and data : object with the data to pass to the document . update
function MapCollection(collection, mapFunction)
{
    return collection.get()
        .then(qrySnapshot=>{
            const promises = [];
            qrySnapshot.forEach(doc=>{
                const data = doc.data();
                const mapResult = mapFunction(data);
                if(mapResult.include)
                {
                    promises.push(collection.doc(doc.id).update(mapResult.data));
                }
            });
            return Promise.all(promises);
        });
}
function MapCollection ( collection , mapFunction ) { return collection . get ( ) . then ( qrySnapshot => { const promises = [ ] ; qrySnapshot . forEach ( doc => { const data = doc . data ( ) ; const mapResult = mapFunction ( data ) ; if ( mapResult . include ) { promises . push ( collection . doc ( doc . id ) . update ( mapResult . data ) ) ; } } ) ; return Promise . all ( promises ) ; } ) ; }
document and data:object with the data to pass to the document.update
document and data : object with the data to pass to the document . update