Skip to content

Commit

Permalink
[fix] Allow EventEmitter to be imported as module namespace (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
delta62 authored and lpinca committed Sep 27, 2016
1 parent 5d4cd19 commit c71d4db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
//
EventEmitter.prefixed = prefix;

//
// Allow `EventEmitter` to be imported as module namespace.
//
EventEmitter.EventEmitter = EventEmitter;

//
// Expose the module.
//
Expand Down
4 changes: 4 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ describe('EventEmitter', function tests() {
assume(EventEmitter.prefixed).is.either([false, '~']);
});

it('exposes a module namespace object', function() {
assume(EventEmitter.EventEmitter).equals(EventEmitter);
});

it('inherits when used with `require("util").inherits`', function () {
function Beast() {
EventEmitter.call(this);
Expand Down

0 comments on commit c71d4db

Please sign in to comment.