-
-
Save parzibyte/39866fe4cd40138fd9bffb7f86d6fe10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const producto = "Nintendo Switch OLED con 2 juegos incluidos (Zelda BOTW y TOTK)"; | |
const cantidad = "1.00"; | |
const subtotal = "$152,986.22"; | |
const longitudProducto = 10; | |
const longitudCantidad = 5; | |
const longitudSubtotal = 6; | |
const separadorColumnas = "|"; | |
const separadorColumnasEnSeparador = "+"; | |
const columnasEncabezado = [{ contenido: "Producto", maximaLongitud: longitudProducto }, { contenido: "Cant.", maximaLongitud: longitudCantidad }, { contenido: "Precio", maximaLongitud: longitudSubtotal },]; | |
const columnasContenido = [{ contenido: producto, maximaLongitud: longitudProducto }, { contenido: cantidad, maximaLongitud: longitudCantidad }, { contenido: subtotal, maximaLongitud: longitudSubtotal },]; | |
const lineasEncabezado = tabularDatos(columnasEncabezado, " ", separadorColumnas); | |
const lineasSeparador = tabularDatos([{ contenido: "-", maximaLongitud: longitudProducto }, { contenido: "-", maximaLongitud: longitudCantidad }, { contenido: "-", maximaLongitud: longitudSubtotal }], "-", separadorColumnasEnSeparador); | |
const lineasCuerpo = tabularDatos(columnasContenido, " ", separadorColumnas); | |
for (const linea of lineasEncabezado) { | |
console.log(linea); | |
} | |
for (const linea of lineasSeparador) { | |
console.log(linea); | |
} | |
for (const linea of lineasCuerpo) { | |
console.log(linea); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment