Comparing version 0.1.4 to 0.1.5
@@ -13,40 +13,20 @@ var util = require('util'), | ||
var line = ''; | ||
var buffer = ''; | ||
reader.setEncoding(encoding || 'utf-8'); | ||
reader.on('data', function(data) { | ||
var lines = data.split("\n"); | ||
if (data.charAt(data.length - 1) == "\n") { | ||
// get rid of last "" after last "\n" | ||
lines.pop(1); | ||
} | ||
if (lines.length > 0) { | ||
//console.log('Have ' + lines.length + " lines\n"); | ||
lines.forEach(function(one_line, index) { | ||
line += one_line; | ||
var emit = true; | ||
if (index == lines.length - 1) { | ||
// processing last line | ||
if (data.charAt(data.length - 1) != "\n") { | ||
// if it was not terminated by "\n" then the last line was not finished; we just buffer it. | ||
//console.log('last one does not have \n, not emitting'); | ||
emit = false; | ||
} | ||
} | ||
if (emit) { | ||
line = line.replace("\r", ''); | ||
//console.log('emiting ' + line + "\n"); | ||
self.emit('line', line); | ||
line = ''; | ||
} | ||
}) | ||
} | ||
var lines = (buffer + data).split("\n"); | ||
buffer = lines.pop(); | ||
lines.forEach(function(line, index) { | ||
line = line.replace("\r", ''); | ||
self.emit('line', line); | ||
}); | ||
}); | ||
var ender = function() { | ||
if (line.length > 0) { | ||
line = line.replace("\r", ''); | ||
self.emit('line', line); | ||
line = ''; | ||
if (buffer.length > 0) { | ||
buffer = buffer.replace("\r", ''); | ||
self.emit('line', buffer); | ||
buffer = ''; | ||
} | ||
@@ -53,0 +33,0 @@ self.emit('end'); |
{ "name" : "carrier" | ||
, "description" : "Evented stream line reader for node.js" | ||
, "version" : "0.1.4" | ||
, "version" : "0.1.5" | ||
, "homepage" : "http://github.com/pgte/carrier" | ||
@@ -5,0 +5,0 @@ , "author" : |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
4
6846
148