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

eventemitter-ex

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventemitter-ex - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

8

EventEmitterEx.js

@@ -270,2 +270,10 @@ 'use strict';

EventEmitterEx.fromPromise = function fromPromise (promise) {
var eex = new EventEmitterEx();
promise.then(eex.emit.bind(eex, 'end'), eex.emit.bind(eex, 'error'));
return eex;
};
function assertIsFunction (f) {

@@ -272,0 +280,0 @@ if (typeof f !== 'function')

2

package.json
{
"name": "eventemitter-ex",
"version": "1.1.0",
"version": "1.2.0",
"description": "EventEmitter extensions",

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

@@ -68,2 +68,32 @@ 'use strict';

describe('#fromPromise()', function () {
it('should emit end when promise is resolved', function (done) {
var p = Promise.resolve(42);
var eex = EEX.fromPromise(p);
eex
.on('end', function (res) {
res.should.equal(42);
done();
})
.on('error', done);
});
it('should emit error when promise is rejected', function (done) {
var ERROR = new Error('Boom!');
var p = Promise.reject(ERROR);
var eex = EEX.fromPromise(p);
eex
.on('error', function (err) {
err.should.equal(ERROR);
done();
})
.on('end', function () {
done(new Error('WTF?'));
});
});
});
});

@@ -70,0 +100,0 @@

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