Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with multi-line content #18

Open
caub opened this issue Dec 7, 2017 · 1 comment
Open

Doesn't work with multi-line content #18

caub opened this issue Dec 7, 2017 · 1 comment

Comments

@caub
Copy link

caub commented Dec 7, 2017

var Table = require('easy-table')

var data = [
  { id: 123123, desc: 'Something \nawesome', price: 1000.00 },
  { id: 245452, desc: 'Very interesting book', price: 11.45},
  { id: 232323, desc: 'Yet another product', price: 555.55 }
]

var t = new Table

data.forEach(function(product) {
  t.cell('Product Id', product.id)
  t.cell('Description', product.desc)
  t.cell('Price, USD', product.price, Table.number(2))
  t.newRow()
})

console.log(t.toString())
Product Id  Description            Price, USD
----------  ---------------------  ----------
123123      Something 
awesome         1000.00
245452      Very interesting book       11.45
232323      Yet another product        555.55
@kevinsimper
Copy link

kevinsimper commented Feb 16, 2018

I was just looking for the same thing 😄 I guess that it would make it a great deal more complicated to detect line break and then format it after that.

It could just create a new row, but if more columns contain a newline, one row could generate multiple extra rows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants