ff-data-to-table
Function that takes a stream of data (array of objects or JSON equivalent) and returns a snabbdom table
Usage:
import flyd from 'flyd'import toTable from 'ff-data-to-table' const data = [ { city: 'Shanghai' , nation: 'China' , population: 24256800 }, { city: 'Karachi' , population: 23500000 , nation: 'Pakistan' , elevation: '8 m' }, { city: 'Beijing' , nation: 'China' , population: 21516000 }, { city: 'São Paulo' , nation: 'Brazil' , population: 12038175 , mayor: 'João Doria' }, { city: 'Dhaka' , population: 16970105 , nation: 'Bangladesh' }] toTable(flyd.stream(data))
What the above snabbdom table would look like when rendered:
city | nation | population | elevation | mayor |
---|---|---|---|---|
Shanghai | China | 24256800 | ||
Karachi | Pakistan | 23500000 | 8 m | |
Beijing | China | 21516000 | ||
Sao Paulo | Brazil | 12038175 | João Doria | |
Dhaka | Bangladesh | 16970105 |