This was solved by using a hidden property of the DB object
function doesThings(some_object) {
var _DB;
switch (some_object._adapter._description) {
case 'DB':
_DB = DB;
break;
case 'OnlineDB':
_DB = OnlineDB;
break;
case 'LocalDB':
_DB = LocalDB;
break;
}
var batch = new _DB.Batch();
}