diff --git a/lib/list.js b/lib/list.js index a7e741ca..53476458 100644 --- a/lib/list.js +++ b/lib/list.js @@ -59,7 +59,8 @@ function List(data, type, parent) { var _; try { - _ = require('underscore'); + var underscore = 'underscore'; + _ = require(underscore); } catch (e) { _ = false; } diff --git a/lib/schema.js b/lib/schema.js index 3d0ee67a..9e13a6e7 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -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')) {