Skip to content

Commit

Permalink
Add default export for better ES module (TypeScript) compatibility (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed Aug 28, 2018
1 parent 2dab8b9 commit 9a5435b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/authentication-oauth2/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const INCLUDE_KEYS = [

const EXCLUDE_KEYS = ['Verifier', 'Strategy', 'formatter'];

module.exports = function init (options = {}) {
function init (options = {}) {
return function oauth2Auth () {
const app = this;
const _super = app.setup;
Expand Down Expand Up @@ -99,9 +99,12 @@ module.exports = function init (options = {}) {
return result;
};
};
};
}

module.exports = init;

// Exposed Modules
Object.assign(module.exports, {
default: init,
Verifier: DefaultVerifier
});
4 changes: 4 additions & 0 deletions packages/authentication-oauth2/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ describe('@feathersjs/authentication-oauth2', () => {
expect(typeof require('../lib')).to.equal('function');
});

it('exports default', () => {
expect(oauth2.default).to.equal(oauth2);
});

it('basic functionality', () => {
expect(typeof oauth2).to.equal('function');
});
Expand Down

0 comments on commit 9a5435b

Please # to comment.