UNPKG

783 BJavaScriptView Raw
1// Generated by CoffeeScript 1.6.3
2(function() {
3 var RowStream, through;
4
5 through = require('through');
6
7 module.exports = RowStream = function(columns) {
8 return through(function(data) {
9 var cells;
10 cells = columns.map(function(column) {
11 var cell;
12 cell = {};
13 cell.value = data[column.property];
14 if (column.className) {
15 cell.className = column.className;
16 } else {
17 cell.className = column.property;
18 }
19 cell.serialized = JSON.stringify(cell.value);
20 if (column.template) {
21 cell.text = column.template(cell.value);
22 } else {
23 cell.text = cell.value;
24 }
25 return cell;
26 });
27 return this.emit('data', cells);
28 });
29 };
30
31}).call(this);