readable-stream
Advanced tools
Comparing version 2.3.1 to 2.3.2
@@ -411,13 +411,24 @@ // Copyright Joyent, Inc. and other Node contributors. | ||
--state.pendingcb; | ||
if (sync) processNextTick(afterError, stream, state, cb, er);else afterError(stream, state, cb, er); | ||
stream._writableState.errorEmitted = true; | ||
stream.emit('error', er); | ||
if (sync) { | ||
// defer the callback if we are being called synchronously | ||
// to avoid piling up things on the stack | ||
processNextTick(cb, er); | ||
// this can emit finish, and it will always happen | ||
// after error | ||
processNextTick(finishMaybe, stream, state); | ||
stream._writableState.errorEmitted = true; | ||
stream.emit('error', er); | ||
} else { | ||
// the caller expect this to happen before if | ||
// it is async | ||
cb(er); | ||
stream._writableState.errorEmitted = true; | ||
stream.emit('error', er); | ||
// this can emit finish, but finish must | ||
// always follow error | ||
finishMaybe(stream, state); | ||
} | ||
} | ||
function afterError(stream, state, cb, err) { | ||
cb(err); | ||
finishMaybe(stream, state); | ||
} | ||
function onwriteStateUpdate(state) { | ||
@@ -653,2 +664,2 @@ state.writing = false; | ||
cb(err); | ||
}; | ||
}; |
@@ -5,4 +5,2 @@ 'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -26,61 +24,53 @@ | ||
_createClass(BufferList, [{ | ||
key: 'push', | ||
value: function push(v) { | ||
var entry = { data: v, next: null }; | ||
if (this.length > 0) this.tail.next = entry;else this.head = entry; | ||
this.tail = entry; | ||
++this.length; | ||
BufferList.prototype.push = function push(v) { | ||
var entry = { data: v, next: null }; | ||
if (this.length > 0) this.tail.next = entry;else this.head = entry; | ||
this.tail = entry; | ||
++this.length; | ||
}; | ||
BufferList.prototype.unshift = function unshift(v) { | ||
var entry = { data: v, next: this.head }; | ||
if (this.length === 0) this.tail = entry; | ||
this.head = entry; | ||
++this.length; | ||
}; | ||
BufferList.prototype.shift = function shift() { | ||
if (this.length === 0) return; | ||
var ret = this.head.data; | ||
if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; | ||
--this.length; | ||
return ret; | ||
}; | ||
BufferList.prototype.clear = function clear() { | ||
this.head = this.tail = null; | ||
this.length = 0; | ||
}; | ||
BufferList.prototype.join = function join(s) { | ||
if (this.length === 0) return ''; | ||
var p = this.head; | ||
var ret = '' + p.data; | ||
while (p = p.next) { | ||
ret += s + p.data; | ||
}return ret; | ||
}; | ||
BufferList.prototype.concat = function concat(n) { | ||
if (this.length === 0) return Buffer.alloc(0); | ||
if (this.length === 1) return this.head.data; | ||
var ret = Buffer.allocUnsafe(n >>> 0); | ||
var p = this.head; | ||
var i = 0; | ||
while (p) { | ||
copyBuffer(p.data, ret, i); | ||
i += p.data.length; | ||
p = p.next; | ||
} | ||
}, { | ||
key: 'unshift', | ||
value: function unshift(v) { | ||
var entry = { data: v, next: this.head }; | ||
if (this.length === 0) this.tail = entry; | ||
this.head = entry; | ||
++this.length; | ||
} | ||
}, { | ||
key: 'shift', | ||
value: function shift() { | ||
if (this.length === 0) return; | ||
var ret = this.head.data; | ||
if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; | ||
--this.length; | ||
return ret; | ||
} | ||
}, { | ||
key: 'clear', | ||
value: function clear() { | ||
this.head = this.tail = null; | ||
this.length = 0; | ||
} | ||
}, { | ||
key: 'join', | ||
value: function join(s) { | ||
if (this.length === 0) return ''; | ||
var p = this.head; | ||
var ret = '' + p.data; | ||
while (p = p.next) { | ||
ret += s + p.data; | ||
}return ret; | ||
} | ||
}, { | ||
key: 'concat', | ||
value: function concat(n) { | ||
if (this.length === 0) return Buffer.alloc(0); | ||
if (this.length === 1) return this.head.data; | ||
var ret = Buffer.allocUnsafe(n >>> 0); | ||
var p = this.head; | ||
var i = 0; | ||
while (p) { | ||
copyBuffer(p.data, ret, i); | ||
i += p.data.length; | ||
p = p.next; | ||
} | ||
return ret; | ||
} | ||
}]); | ||
return ret; | ||
}; | ||
return BufferList; | ||
}(); |
{ | ||
"name": "readable-stream", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"description": "Streams3, a user-land copy of the stream library from Node.js", | ||
@@ -5,0 +5,0 @@ "main": "readable.js", |
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
86737
1883