0.0.1 • Published 7 years ago

ff-data-to-table v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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:

citynationpopulationelevationmayor
ShanghaiChina24256800
KarachiPakistan235000008 m
BeijingChina21516000
Sao PauloBrazil12038175João Doria
DhakaBangladesh16970105