-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If `writeOptions.columns` is not defined and `writeOptions.newColumns` is defined, any new keys added to the object returned by `transform()` will be added as an output column. See #31
- Loading branch information
Showing
8 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,lastname,firstname | ||
82,Preisner,Zbigniew | ||
94,Gainsbourg,Serge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
// CSV sample - Copyright David Worms <open@adaltas.com> (BSD Licensed) | ||
|
||
// node samples/column.js | ||
var csv = require('..'); | ||
|
||
csv() | ||
.fromPath(__dirname+'/columns.in',{ | ||
columns: true | ||
}) | ||
.toStream(process.stdout, { | ||
newColumns: true, | ||
end: false | ||
}) | ||
.transform(function(data){ | ||
data.name = data.firstname + ' ' + data.lastname | ||
return data; | ||
}); | ||
|
||
// Will print sth like: | ||
// 82,Preisner,Zbigniew,Zbigniew Preisner | ||
// 94,Gainsbourg,Serge,Serge Gainsbourg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FIELD_1,FIELD_2,FIELD_3,FIELD_4,FIELD_5,FIELD_6 | ||
20322051544,1979,8.8017226E7,ABC,45,2000-01-01 | ||
28392898392,1974,8.8392926E7,DEF,23,2050-11-27 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FIELD_1,FIELD_2,FIELD_3,FIELD_4,FIELD_5,FIELD_6,FIELD_7 | ||
20322051544,1979,8.8017226E7,ABC,45,2000-01-01,new_field | ||
28392898392,1974,8.8392926E7,DEF,23,2050-11-27,new_field |