New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

async-writer

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-writer - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

39

lib/AsyncWriter.js

@@ -46,4 +46,14 @@ /*

var global = asyncWriter.global;
var events = global.events;
if (event === 'end') {
var endEvent = (event === 'end');
if (endEvent) {
console.error('WARNING: "end" event type is deprecated. Use "finish" instead.', (new Error()).stack);
}
// Writable streams are only suppose to emit "finish" but
// "through" streams (from the "through" module) only output
// "end" event. Therefor, we need to normalize "end" and "finish"
// events
if (endEvent || (event === 'finish')) {
if (global.ended) {

@@ -53,6 +63,20 @@ callback();

}
var emitted = false;
var onFinish = function() {
if (emitted) {
return;
}
emitted = true;
callback();
};
events[type]('end', onFinish);
events[type]('finish', onFinish);
} else {
events[type](event, callback);
}
var events = global.events;
events[type](event, callback);
return asyncWriter;

@@ -300,6 +324,2 @@ }

if (event === 'end') {
global.ended = true;
}
var events = global.events;

@@ -381,6 +401,7 @@ events.emit.apply(events, arguments);

if (async.remaining === 0) {
this.global.ended = true;
if (this.stream.end) {
this.stream.end();
} else {
this.emit('end');
this.emit('finish');
}

@@ -387,0 +408,0 @@ }

@@ -27,3 +27,3 @@ {

},
"version": "1.2.1"
"version": "1.2.2"
}

@@ -28,3 +28,3 @@ 'use strict';

out.end();
out.on('end', function() {
out.on('finish', function() {
var output = out.getOutput();

@@ -55,3 +55,3 @@ expect(output).to.equal('1234');

out.end();
out.on('end', function() {
out.on('finish', function() {
var output = out.getOutput();

@@ -75,3 +75,3 @@ expect(output).to.equal('1234');

out.end();
out.on('end', function() {
out.on('finish', function() {
var output = out.getOutput();

@@ -94,3 +94,3 @@ expect(output).to.equal('123');

out.end();
out.on('end', function() {
out.on('finish', function() {
var output = out.getOutput();

@@ -120,3 +120,3 @@ expect(output).to.equal('123');

out.on('end', function() {
out.on('finish', function() {
expect(errors.length).to.equal(1);

@@ -169,3 +169,3 @@ expect(out.getOutput()).to.equal('13');

out.end();
out.on('end', function() {
out.on('finish', function() {
var output = out.getOutput();

@@ -192,3 +192,3 @@ expect(output).to.equal('12a2b2c34a4b4c');

out.end();
out.on('end', function() {
out.on('finish', function() {
var output = out.getOutput();

@@ -207,3 +207,3 @@ expect(errors.length).to.equal(1);

})
.on('end', function() {
.on('finish', function() {
var output = out.getOutput();

@@ -239,3 +239,3 @@ expect(errors.length).to.equal(1);

})
.on('end', function() {
.on('finish', function() {
expect(errors.length).to.equal(0);

@@ -275,3 +275,3 @@ expect(output).to.equal('123');

})
.on('end', function() {
.on('finish', function() {
})

@@ -302,3 +302,3 @@ .write('1');

out.end();
out.on('end', function() {
out.on('finish', function() {
var output = out.getOutput();

@@ -323,6 +323,3 @@ expect(output).to.equal('1Hello World2');

.pipe(out)
.on('end', function() {
expect(outStr).to.equal('1Hello World2');
done();
})
.on('error', function(e) {

@@ -341,2 +338,8 @@ done(e);

out.write('2');
out.on('finish', function() {
expect(outStr).to.equal('1Hello World2');
done();
});
out.end();

@@ -359,3 +362,3 @@

out.end();
out.on('end', function() {
out.on('finish', function() {
var output = out.getOutput();

@@ -390,3 +393,3 @@ expect(output).to.equal('123');

out.end();
out.on('end', function() {
out.on('finish', function() {
expect(lastFiredCount).to.equal(1);

@@ -393,0 +396,0 @@ var output = out.getOutput();

Sorry, the diff of this file is not supported yet

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