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

247
Vistas
JavaScript Map RangeError: Invalid array length

I am using the docx node library and attempting to autogenerate a table from an array. The challenge is that beyond returning data I need to return a structure, but when I run my map it fails with the following:

RangeError: Invalid array length

Here is my sample code I am testing with.

const rowChildren = [
    {firstName : "Susan", lastName: "Steward"},
    {firstName : "Daniel", lastName: "Longbottom"},
    {firstName : "Jacob", lastName: "Black"}
  ];

const table = new Table({
    rows: [rowChildren.map(function(element){ return new TableRow({
      children: [
        new TableCell({
        children: [new Paragraph(element.firstName)],
    }), //each entry is an array of TableCell that make up this row
],
    })},
),
],
  });
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Your map() already return an array TableRow[], just remove you [ ] before map() at rows key. This will resolve your RangeError: Invalid array length error.

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