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

154
Views
Use map object instead of params correctly

I want to use map object instead of calling checkOrder 3 times. How to use via Map instead of all params in this case? :

Admin.ts

class Admin{
  async checkTest(
    local: string,
    suburb: string,
    international: string
  ): Promise<void> {
    await checkOrder(local, "Declined");
    await checkOrder(suburb, "Declined");
    await checkOrder(international, "Declined");
    return;
  }
}

Test.ts

test("Test", async (t) => {
  await Admin.checkTest(
    "Local Place",
    "Suburb Place",
    "International Place"
  );
  );
}
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

@Thomas I want to use map object instead of calling checkOrder 3 times .

like this?

class Admin {
  async checkTest(map: Map<Place, Status>) {
    for (let [place, status] of map) {
      await checkOrder(place, status);
    }
  }
}

and

test("Test", async (t) => {
  await Admin.checkTest(
    new Map([
      ["Local Place", "Declined"],
      ["Suburb Place", "Declined"],
      ["International Place", "Declined"],
    ])
  );
});
about 4 years ago · Juan Pablo Isaza Report

0

So, is it correct map using in my case ?

class Admin {
  async checkTest(map: Map<string, string>) {
    for (let [place, status] of map) {
      await checkOrder(place, status);
    }
  }
}

and

test("Test", async (t) => {
  await Admin.checkTest(
    new Map([
      ["Local Place", "Declined"],
      ["Suburb Place", "Declined"],
      ["International Place", "Declined"],
    ])
  );
});

about 4 years ago · Juan Pablo Isaza Report
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!