Accept adapter as first argument of Schema constructor
This commit is contained in:
parent
5efd832881
commit
e9b7e89ee9
|
@ -59,7 +59,8 @@ function List(data, type, parent) {
|
|||
|
||||
var _;
|
||||
try {
|
||||
_ = require('underscore');
|
||||
var underscore = 'underscore';
|
||||
_ = require(underscore);
|
||||
} catch (e) {
|
||||
_ = false;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,10 @@ function Schema(name, settings) {
|
|||
// this is only one initialization entry point of adapter
|
||||
// this module should define `adapter` member of `this` (schema)
|
||||
var adapter;
|
||||
if (name.match(/^\//)) {
|
||||
if (typeof name === 'object') {
|
||||
adapter = name;
|
||||
this.name = adapter.name;
|
||||
} else if (name.match(/^\//)) {
|
||||
// try absolute path
|
||||
adapter = require(name);
|
||||
} else if (existsSync(__dirname + '/adapters/' + name + '.js')) {
|
||||
|
|
Loading…
Reference in New Issue