Comparing version 2.8.4 to 2.8.5
44
index.js
@@ -18,6 +18,2 @@ 'use strict' | ||
const PAUSED = Symbol('paused') | ||
// enum for paused states. | ||
const PAUSE_FALSE = Symbol('pausedFalse') | ||
const PAUSE_IMPLICIT = Symbol('pausedImplicit') | ||
const PAUSE_EXPLICIT = Symbol('pausedExplicit') | ||
const RESUME = Symbol('resume') | ||
@@ -51,3 +47,3 @@ const BUFFERLENGTH = Symbol('bufferLength') | ||
class Minipass extends EE { | ||
module.exports = class Minipass extends EE { | ||
constructor (options) { | ||
@@ -57,3 +53,3 @@ super() | ||
// whether we're explicitly paused | ||
this[PAUSED] = PAUSE_FALSE | ||
this[PAUSED] = false | ||
this.pipes = new Yallist() | ||
@@ -222,3 +218,3 @@ this.buffer = new Yallist() | ||
// This makes MP more suitable to write-only use cases. | ||
if (this.flowing || this[PAUSED] !== PAUSE_EXPLICIT) | ||
if (this.flowing || !this[PAUSED]) | ||
this[MAYBE_EMIT_END]() | ||
@@ -233,3 +229,3 @@ return this | ||
this[PAUSED] = PAUSE_FALSE | ||
this[PAUSED] = false | ||
this[FLOWING] = true | ||
@@ -249,10 +245,5 @@ this.emit('resume') | ||
[PAUSE_IMPLICIT] () { | ||
this[FLOWING] = false | ||
this[PAUSED] = PAUSE_IMPLICIT | ||
} | ||
pause () { | ||
this[FLOWING] = false | ||
this[PAUSED] = PAUSE_EXPLICIT | ||
this[PAUSED] = true | ||
} | ||
@@ -269,3 +260,3 @@ | ||
get paused () { | ||
return this[PAUSED] !== PAUSE_FALSE | ||
return this[PAUSED] | ||
} | ||
@@ -313,17 +304,7 @@ | ||
// ondrain only resumes in the PAUSE_IMPLICIT case, not PAUSE_EXPLICIT | ||
// don't bother calling resume if we're already flowing. | ||
const p = { | ||
dest: dest, | ||
opts: opts, | ||
ondrain: _ => this[PAUSED] === PAUSE_IMPLICIT && this[RESUME]() | ||
} | ||
const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() } | ||
this.pipes.push(p) | ||
dest.on('drain', p.ondrain) | ||
// don't start flowing if we're explicitly paused | ||
if (this[PAUSED] !== PAUSE_EXPLICIT) | ||
this[RESUME]() | ||
this[RESUME]() | ||
// piping an ended stream ends immediately | ||
@@ -343,4 +324,3 @@ if (ended && p.opts.end) | ||
} finally { | ||
if (ev === 'data' && !this.pipes.length && !this.flowing && | ||
this[PAUSED] !== PAUSE_EXPLICIT) | ||
if (ev === 'data' && !this.pipes.length && !this.flowing) | ||
this[RESUME]() | ||
@@ -384,3 +364,3 @@ else if (isEndish(ev) && this[EMITTED_END]) { | ||
this.pipes.forEach(p => | ||
p.dest.write(data) === false && this[PAUSE_IMPLICIT]()) | ||
p.dest.write(data) === false && this.pause()) | ||
} else if (ev === 'end') { | ||
@@ -484,3 +464,3 @@ // only actual end gets this treatment | ||
this.removeListener('end', onend) | ||
this[PAUSE_IMPLICIT]() | ||
this.pause() | ||
resolve({ value: value, done: !!this[EOF] }) | ||
@@ -550,3 +530,1 @@ } | ||
} | ||
module.exports = Minipass |
{ | ||
"name": "minipass", | ||
"version": "2.8.4", | ||
"version": "2.8.5", | ||
"description": "minimal implementation of a PassThrough stream", | ||
@@ -5,0 +5,0 @@ "main": "index.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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
30154
444