stream-lines
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -1,3 +0,2 @@ | ||
var util = require('util') | ||
, Transform = require('stream').Transform | ||
var through = require('through3') | ||
, LF = '\n'.charCodeAt(0); | ||
@@ -15,9 +14,3 @@ | ||
*/ | ||
function LineReader(options) { | ||
if(!(this instanceof LineReader)) { | ||
return new LineReader(options); | ||
} | ||
Transform.call(this); | ||
this._writableState.objectMode = false; | ||
this._readableState.objectMode = true; | ||
function LineStream(options) { | ||
options = options || {}; | ||
@@ -28,8 +21,6 @@ this.encoding = options.encoding || 'utf8'; | ||
util.inherits(LineReader, Transform); | ||
/** | ||
* Transform function. | ||
*/ | ||
function _transform(chunk, encoding, cb) { | ||
function transform(chunk, encoding, cb) { | ||
var str, lines, i = chunk.length - 1, b; | ||
@@ -73,3 +64,3 @@ | ||
function _flush() { | ||
function flush(cb) { | ||
var lines; | ||
@@ -83,7 +74,5 @@ // unterminated last line, need to flush it | ||
this.buffer = null; | ||
cb(); | ||
} | ||
LineReader.prototype._transform = _transform; | ||
LineReader.prototype._flush = _flush; | ||
module.exports = LineReader; | ||
module.exports = through.transform(transform, flush, {ctor: LineStream}); |
{ | ||
"name": "stream-lines", | ||
"description": "Line transform stream, reads bytes writes arrays of lines.", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"author": "muji <noop@xpm.io>", | ||
@@ -10,3 +10,5 @@ "repository": { | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"through3": "~1.1.1" | ||
}, | ||
"devDependencies": { | ||
@@ -13,0 +15,0 @@ "chai": "~1.10.0", |
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
5193
1
67
+ Addedthrough3@~1.1.1
+ Addedthrough3@1.1.7(transitive)