Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
Unhandled Rejection (TypeError): Cannot read properties of undefined (reading 'forEach'

here is such a mistake Unhandled Rejection (TypeError): Cannot read properties of undefined (reading 'forEach') (anonymous function) http://localhost:3000/portfolio/arbitunity/static/js/main.chunk.js:3059:30 3056 | 3057 | dataset.forEach(exchange => { 3058 | // then iterate over every coin

3059 | exchange.pairs.formatted.forEach(coin => { | ^ 3060 | // map over already processed coins (uniqueCoinsAndPrices) 3061 | // check if entry of said coin already exists 3062 | const found = uniqueCoinsAndPrices.some(item => item.name === coin.name); // if not found, push a new object (inluding coin name) to array View source getUniqueCoinsAndPrices C:/Users/Admin/Desktop/arbitunity-master/src/functions/calculations/getUniqueCoinsAndPrices.js:5 2 | const uniqueCoinsAndPrices = []; 3 | 4 | // iterate over every exchange 5 | dataset.forEach((exchange) => { | ^ 6 | // then iterate over every coin 7 | exchange.pairs.formatted.forEach((coin) => { 8 | // map over already processed coins (uniqueCoinsAndPrices)

enter image description here

    export const getUniqueCoinsAndPrices = (dataset) => {
  const uniqueCoinsAndPrices = [];

  // iterate over every exchange
  dataset.forEach((exchange) => {
    // then iterate over every coin
    exchange.pairs.formatted.forEach((coin) => {
      // map over already processed coins (uniqueCoinsAndPrices)
      // check if entry of said coin already exists
      const found = uniqueCoinsAndPrices.some(
        (item) => item.name === coin.name
      );

      // if not found, push a new object (inluding coin name) to array
      if (!found) {
        uniqueCoinsAndPrices.push({
          name: coin.name,
          id: coin.id,
          priceList: [
            {
              exchange: `${exchange.name}`,
              price: coin.price,
            },
          ],
        });
      }

      // if found -> check at which index,
      // update only the price (add price @ ExchangeXYZ to list)
      // (useless on the first exchange, but needed for comparing data of multiple ones)
      else {
        const index = uniqueCoinsAndPrices
          .map((element) => element.name)
          .indexOf(coin.name);

        uniqueCoinsAndPrices[index].priceList.push({
          exchange: `${exchange.name}`,
          price: coin.price,
        });
      }
    });
  });
  return uniqueCoinsAndPrices;
};

enter image description here

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!