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

237
Views
How to get string converted to array?

I am kind of new to this, but this is giving me a headache. Heres my code what i am trying to solve:

function parseComponents(data: any, excelAttributesArray: string[]) {
    let confs = "";
    let isValues = false;
    let listValues = "";

    if (!data) return confs;
    if (data["Part"]) {
        const part = data["Part"];
        excelAttributesArray.forEach((attribute) => {
            let attributeValue = part[attribute];
            if (attributeValue !== null) isValues = true;
            if (attributeValue !== null && attributeValue.Value) {
                attributeValue = attributeValue.Value;
            }
            listValues += attributeValue + ",";
        });

        const number = part["Number"];
        if (isValues) {
            confs += `${listValues}${number}`;
        }
    }
    if (data["Components"] && data["Components"].length > 0) {
        for (let i = 0; i < data["Components"].length; i++) {
            const tmp = parseComponents(
                data["Components"][i],
                excelAttributesArray
            );
            if (tmp && tmp.length > 0)
                confs += (confs.length > 0 ? "|" : "") + tmp;
        }
    }
    return confs;
}

The confs value is returned as a string. How do i get it return as array?

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!