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

165
Views
[Performing issue]Map over an variable and change its value in typescript

Edit: I' ve found a similar question and resolved this with this code:

testeTipoMySQLtoOracle(testeTipo: any) {

    var tipoNumber = {
        "aceitacao": 1,
        "integracao": 4,
        "interface-mobile": 5,
        "interface-web": 6,
        "performance": 7,      
        "unitario": 8,
    };
    var indice: keyof typeof tipoNumber = testeTipo; 

    if (indice in tipoNumber) {
        return tipoNumber[indice];
    }
}

I Want to receive a value and change it before sending a request to my DataBase. One DataBase send me a string and I must assign its equivalent number before sending it to the other DataBase.

Here is what I have so far:

testeTipoMySQL(testeTipo: string){
        if(testeTipo == "aceitacao"){
            return 1;
        }else if(testeTipo == "integracao"){
            return 4;
        }else if(testeTipo == "interface-mobile"){
            return 5;
        }else if(testeTipo == "interface-web"){
            return 6;
        }else if(testeTipo == "performance"){
            return 7;
        }else if(testeTipo == "unitario"){
            return 8;
        }
    } 

I want to know if is there another better way of doing it that I'm not seeing cause I'm new to JavasCript.

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!