filter() and includes()
files.filter(file => videoFileTypes.includes(file.mimeType));
Only return the list items where it matches a certain value from this list.
Take the list that has required items and look at the properties where the comparison should take place
setInterval()
reduce()
How to generate sites from a sheet
Read the sheet data into a JSON object
Use that JSON object as a config
How did we build this customer map?
function buildCustomerAccounts() {
const customers = extractAllQboCustomers();
const invoices = extractAllQboCustomerInvoices();
const payments = extractAllQboCustomerPayments();
const customerMap = {};
customers.forEach(customer => {
customerMap[customer.Id] = {
customerId: customer.Id,
displayName: customer.DisplayName,
email: customer.PrimaryEmailAddr ? c.PrimaryEmailAddr.Address : “”,
invoices: [],
payments: [],
outstandingBalance: 0
};
});
invoices.forEach(inv => {
const custId = inv.CustomerRef.value;
if (!customerMap[custId]) return; // skip if customer not found
customerMap[custId].invoices.push({
id: inv.Id,
txnDate: inv.TxnDate,
total: inv.TotalAmt,
balance: inv.Balance
});
customerMap[custId].outstandingBalance += inv.Balance || 0; });payments.forEach(pmt => {
const custId = pmt.CustomerRef.value;
if (!customerMap[custId]) return;
customerMap[custId].payments.push({
id: pmt.Id,
txnDate: pmt.TxnDate,
total: pmt.TotalAmt
}); });debugger;
return customerMap;
}
How to merge these different groups together?