supertest-session
Advanced tools
Comparing version 1.2.0 to 2.0.0
25
index.js
@@ -11,2 +11,3 @@ var assign = require('object-assign'), | ||
// istanbul ignore if | ||
if (!app) { | ||
@@ -77,28 +78,4 @@ throw new Error('Session requires an `app`'); | ||
function legacySession (config) { | ||
if (!config) config = {}; | ||
// Bind session to `config` | ||
function LegacySession () { | ||
Session.call(this, config.app, config); | ||
} | ||
util.inherits(LegacySession, Session); | ||
assign(LegacySession.prototype, {}, config.helpers); | ||
return LegacySession; | ||
} | ||
var deprecatedLegacySession = util.deprecate(legacySession, | ||
'supertest-session: module configuration will be removed in next version.'); | ||
module.exports = function (app, options) { | ||
// Check for legacy interface and provide compatibility | ||
if (app && app.app) { | ||
return deprecatedLegacySession(app); | ||
} | ||
return new Session(app, options); | ||
}; |
{ | ||
"name": "supertest-session", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "Cookie-based session persistence for Supertest", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
15
10655
173