You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {Object|String|Function} adapter - [1] An object implementing the adapter interface, or [2] a function that returns [1], or [3] A string of either the name of an included npm module or a path to a local module that returns [1] or [2].
38
+
* @param {Object} options - An object passed to the adapter on instantiation (if adapter is not already instantiated)
39
+
* @returns {Object} An object implementing the adapter interface
40
+
*/
41
+
resolveAdapter(adapter,options){
42
+
// Support passing in adapter paths
43
+
if(typeofadapter==='string'){
44
+
adapter=require(adapter);
36
45
37
-
/**
38
-
* Resolves the adapter
39
-
*
40
-
* @param {Object|String|Function} adapter - [1] An object implementing the adapter interface, or [2] a function that returns [1], or [3] A string of either the name of an included npm module or a path to a local module that returns [1] or [2].
41
-
* @param {Object} options - An object passed to the adapter on instantiation (if adapter is not already instantiated)
42
-
* @returns {Object} An object implementing the adapter interface
43
-
*/
44
-
functionresolveAdapter(adapter,options){
45
-
// Support passing in adapter paths
46
-
if(typeofadapter==='string'){
47
-
adapter=require(adapter);
48
-
}
46
+
// TODO: Figure out a better way to deal with this
47
+
if(adapter&&adapter.default)
48
+
adapter=adapter.default;
49
+
}
50
+
51
+
// Instantiate the adapter if the class got passed instead of an instance
52
+
if(typeofadapter==='function'){
53
+
adapter=newadapter(options);
54
+
}
49
55
50
-
// Instantiate the adapter if the class got passed instead of an instance
0 commit comments