Skip to content

Commit

Permalink
added sep option to lines transform
Browse files Browse the repository at this point in the history
  • Loading branch information
bjouhier committed Sep 9, 2014
1 parent c6dfcbb commit 4e6043f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/transforms/lines._js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ module.exports = {
options = options || {};

function clean(line) {
return line[line.length - 1] === '\r' ? line.substring(0, line.length - 1) : line;
return (!options.sep && line[line.length - 1] === '\r') ? line.substring(0, line.length - 1) : line;
}
return function(_, reader, writer) {
var remain = "";
reader.forEach(_, function(_, chunk) {
var lines = chunk.split('\n');
var lines = chunk.split(options.sep || '\n');
if (lines.length > 1) {
writer.write(_, clean(remain + lines[0]));
for (var i = 1; i < lines.length - 1; i++) writer.write(_, clean(lines[i]));
Expand Down

0 comments on commit 4e6043f

Please sign in to comment.