1 | through = require 'through'
|
2 |
|
3 | module.exports = RowStream = (columns) ->
|
4 | through (data) ->
|
5 | cells = columns.map (column) ->
|
6 | cell = {}
|
7 |
|
8 | cell.value = data[column.property]
|
9 |
|
10 | if column.className
|
11 | cell.className = column.className
|
12 | else
|
13 | cell.className = column.property
|
14 |
|
15 | cell.serialized = JSON.stringify cell.value
|
16 |
|
17 | if column.template
|
18 | cell.text = column.template cell.value
|
19 | else
|
20 | cell.text = cell.value
|
21 |
|
22 | return cell
|
23 |
|
24 | @emit 'data', cells |
\ | No newline at end of file |