From 68efbb8ae8f6602e801705298368c2b9eb394f7b Mon Sep 17 00:00:00 2001 From: David Luecke Date: Thu, 16 Nov 2017 15:09:25 -0800 Subject: [PATCH] Add default ES module default exports to make TypeScript integration easier (#37) --- packages/authentication-oauth1/lib/index.js | 7 +++++-- packages/authentication-oauth1/test/index.test.js | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/authentication-oauth1/lib/index.js b/packages/authentication-oauth1/lib/index.js index 03c69f1ade..b029d9d7c3 100644 --- a/packages/authentication-oauth1/lib/index.js +++ b/packages/authentication-oauth1/lib/index.js @@ -20,7 +20,7 @@ const INCLUDE_KEYS = [ const EXCLUDE_KEYS = ['Verifier', 'Strategy', 'formatter']; -module.exports = function init (options = {}) { +function init (options = {}) { return function oauth1Auth () { const app = this; const _super = app.setup; @@ -102,9 +102,12 @@ module.exports = function init (options = {}) { return result; }; }; -}; +} + +module.exports = init; // Exposed Modules Object.assign(module.exports, { + default: init, Verifier: DefaultVerifier }); diff --git a/packages/authentication-oauth1/test/index.test.js b/packages/authentication-oauth1/test/index.test.js index 937d638762..7ed3393775 100644 --- a/packages/authentication-oauth1/test/index.test.js +++ b/packages/authentication-oauth1/test/index.test.js @@ -24,6 +24,10 @@ describe('@feathersjs/authentication-oauth1', () => { expect(typeof oauth1).to.equal('function'); }); + it('exports default', () => { + expect(oauth1.default).to.equal(oauth1); + }); + it('exposes the Verifier class', () => { expect(typeof Verifier).to.equal('function'); expect(typeof oauth1.Verifier).to.equal('function');