(name, callback)
| 160 | } |
| 161 | |
| 162 | function adapterFun(name, callback) { |
| 163 | return toPromise(function (...args) { |
| 164 | if (this._closed) { |
| 165 | return Promise.reject(new Error('database is closed')); |
| 166 | } |
| 167 | if (this._destroyed) { |
| 168 | return Promise.reject(new Error('database is destroyed')); |
| 169 | } |
| 170 | var self = this; |
| 171 | logApiCall(self, name, args); |
| 172 | if (!this.taskqueue.isReady) { |
| 173 | return new Promise(function (fulfill, reject) { |
| 174 | self.taskqueue.addTask(function (failed) { |
| 175 | if (failed) { |
| 176 | reject(failed); |
| 177 | } else { |
| 178 | fulfill(self[name].apply(self, args)); |
| 179 | } |
| 180 | }); |
| 181 | }); |
| 182 | } |
| 183 | return callback.apply(this, args); |
| 184 | }); |
| 185 | } |
| 186 | |
| 187 | // like underscore/lodash _.pick() |
| 188 | function pick(obj$$1, arr) { |
no test coverage detected
searching dependent graphs…