Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minipass

Package Overview
Dependencies
Maintainers
9
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minipass - npm Package Compare versions

Comparing version 2.6.0 to 2.6.1

37

index.js

@@ -6,2 +6,3 @@ 'use strict'

const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
const REMOVE_ALL_END_LISTENERS = Symbol('removeAllEndListeners')
const EMITTED_END = Symbol('emittedEnd')

@@ -35,2 +36,10 @@ const EMITTING_END = Symbol('emittingEnd')

// events that mean 'the stream is over'
// these are treated specially, and re-emitted
// if they are listened for after emitting.
const isEndish = ev =>
ev === 'end' ||
ev === 'finish' ||
ev === 'prefinish'
module.exports = class MiniPass extends EE {

@@ -168,4 +177,8 @@ constructor (options) {

this.writable = false
if (this.flowing)
this[MAYBE_EMIT_END]()
// if we haven't written anything, then go ahead and emit,
// even if we're not reading.
// we'll re-emit if a new 'end' listener is added anyway.
// This makes MP more suitable to write-only use cases.
this[MAYBE_EMIT_END]()
return this

@@ -248,5 +261,5 @@ }

this[RESUME]()
else if (ev === 'end' && this[EMITTED_END]) {
super.emit('end')
this.removeAllListeners('end')
else if (isEndish(ev) && this[EMITTED_END]) {
super.emit(ev)
this[REMOVE_ALL_END_LISTENERS]()
}

@@ -265,3 +278,2 @@ }

this[EOF]) {
this[EMITTING_END] = true

@@ -273,2 +285,4 @@ this.emit('end')

this.emit('close')
this[REMOVE_ALL_END_LISTENERS]()
this[EMITTING_END] = false
}

@@ -285,2 +299,3 @@ }

} else if (ev === 'end') {
// only actual end gets this treatment
if (this[EMITTED_END] === true)

@@ -324,9 +339,15 @@ return

} finally {
if (ev !== 'end')
if (!isEndish(ev))
this[MAYBE_EMIT_END]()
else
this.removeAllListeners('end')
this[REMOVE_ALL_END_LISTENERS]()
}
}
[REMOVE_ALL_END_LISTENERS] () {
this.removeAllListeners('end')
this.removeAllListeners('prefinish')
this.removeAllListeners('finish')
}
// const all = await stream.collect()

@@ -333,0 +354,0 @@ collect () {

{
"name": "minipass",
"version": "2.6.0",
"version": "2.6.1",
"description": "minimal implementation of a PassThrough stream",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc