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 _;
|
var _;
|
||||||
try {
|
try {
|
||||||
_ = require('underscore');
|
var underscore = 'underscore';
|
||||||
|
_ = require(underscore);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_ = false;
|
_ = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,10 @@ function Schema(name, settings) {
|
||||||
// this is only one initialization entry point of adapter
|
// this is only one initialization entry point of adapter
|
||||||
// this module should define `adapter` member of `this` (schema)
|
// this module should define `adapter` member of `this` (schema)
|
||||||
var adapter;
|
var adapter;
|
||||||
if (name.match(/^\//)) {
|
if (typeof name === 'object') {
|
||||||
|
adapter = name;
|
||||||
|
this.name = adapter.name;
|
||||||
|
} else if (name.match(/^\//)) {
|
||||||
// try absolute path
|
// try absolute path
|
||||||
adapter = require(name);
|
adapter = require(name);
|
||||||
} else if (existsSync(__dirname + '/adapters/' + name + '.js')) {
|
} else if (existsSync(__dirname + '/adapters/' + name + '.js')) {
|
||||||
|
|
Loading…
Reference in New Issue