I have this code: 

const banks: Consent[] = []
    const ecommerce: Consent[] = []

    company.consents.forEach((consent) => {
      if (['paypal', 'paypal_eu', 'stripe'].includes(consent.institutionId)) {
        ecommerce.push(consent)
      } else if (
        !consent.institution.manual &&
        consent.nickname !== 'Friday Finance'
      ) {
        banks.push(consent)
      }
    })

    return {
      BanksConnectionsCount: banks.length,
      CommerceIntegrationsCount: ecommerce.length,
      AccountingIntegrationsCount: company.integrations.length,
      TeamMembersCount: company.members.length - 1 + company.invites.length, // exclude the one who created the work space.
      CardsCount: Number(cardsResult[0]?.count) || 0,
      CardHoldersCount: Number(cardHoldersResult[0]?.count) || 0,
      ApprovalFlowMembersCount: 0
    }


I think the foreach is not very memory efficent for counting. Can you improve it? The word "counting" should not appear in your response.
user