Skip to content

Commit

Permalink
Add default export for better ES module (TypeScript) compatibility (#100
Browse files Browse the repository at this point in the history
)

* Add default export for better ES module (TypeScript) compatibility

* Use module.exports
  • Loading branch information
daffl committed Aug 22, 2018
1 parent c92653a commit 2c85ff5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/socketio/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const debug = require('debug')('@feathersjs/socketio');

const socketKey = Symbol('@feathersjs/socketio/socket');

module.exports = function (port, options, config) {
function configureSocketio (port, options, config) {
if (typeof port !== 'number') {
config = options;
options = port;
Expand Down Expand Up @@ -99,6 +99,8 @@ module.exports = function (port, options, config) {
emit: 'emit'
}));
};
};
}

module.exports = configureSocketio;
module.exports.default = configureSocketio;
module.exports.SOCKET_KEY = socketKey;
5 changes: 5 additions & 0 deletions packages/socketio/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ describe('@feathersjs/socketio', () => {
server.close(done);
});

it('exports default and SOCKET_KEY', () => {
assert.ok(socketio.SOCKET_KEY);
assert.equal(socketio, socketio.default);
});

it('throws an error when using an incompatible version of Feathers', () => {
const oldFeathers = require('feathers');

Expand Down

0 comments on commit 2c85ff5

Please sign in to comment.