From dff3367f3afda5c526a686398222b1a61b219b61 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Tue, 29 Oct 2013 13:04:23 -0700 Subject: [PATCH] Fix the regression when 1st arg is the connector module --- lib/datasource.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/datasource.js b/lib/datasource.js index b225dabc..83b13d03 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -215,8 +215,13 @@ DataSource.prototype.setup = function(name, settings) { this.name = name; if (name && !connector) { + if (typeof name === 'object') { + // The first argument might be the connector itself + connector = name; + this.name = connector.name; + } // The connector has not been resolved - if (name.match(/^\//)) { + else if (name.match(/^\//)) { // try absolute path connector = require(name); } else if (existsSync(__dirname + '/connectors/' + name + '.js')) {