|
// TODO: move to package |
|
module.exports = function ldu (db, callback) { |
|
const location = reachdown(db).location |
|
|
|
if (!location) { |
|
return process.nextTick(callback, null, null) |
|
} |
|
|
|
du(location, callback) |
|
} |
|
// TODO: move to package (shared with subleveldown, level-test) |
|
module.exports = function reachdown (db, type) { |
|
if (typeof db.down === 'function') return db.down(type) |
|
if (type && db.type === type) return db |
|
if (isLooseAbstract(db.db)) return reachdown(db.db, type) |
|
if (isLooseAbstract(db._db)) return reachdown(db._db, type) |
|
return type ? null : db |
|
} |
And incorporate Level/subleveldown@fbbf525
bench/lib/level-du.js
Lines 6 to 15 in 1225047
bench/lib/reachdown.js
Lines 3 to 10 in 1225047
And incorporate Level/subleveldown@fbbf525