forked from pouchdb/pouchdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
levelalt.js
37 lines (29 loc) · 868 Bytes
/
levelalt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
import LevelPouch from '../adapters/leveldb/index';
import toPromise from '../deps/toPromise';
import extend from '../deps/extend';
export default altFactory;
function altFactory(adapterConfig, downAdapter) {
function LevelPouchAlt(opts, callback) {
var _opts = extend({
db: downAdapter
}, opts);
LevelPouch.call(this, _opts, callback);
}
// overrides for normal LevelDB behavior on Node
LevelPouchAlt.valid = function () {
return adapterConfig.valid();
};
LevelPouchAlt.use_prefix = adapterConfig.use_prefix;
LevelPouchAlt.destroy = toPromise(function (name, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
var _opts = extend({
db: downAdapter
}, opts);
return LevelPouch.destroy(name, _opts, callback);
});
return LevelPouchAlt;
}