Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda