Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.

Commit f6aa149

Browse files
committed
Add db.getMany(keys)
Ref Level/community#101
1 parent 9c6f40f commit f6aa149

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

memdown.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ function MemDOWN () {
158158
snapshots: true,
159159
permanence: false,
160160
seek: true,
161-
clear: true
161+
clear: true,
162+
getMany: true
162163
})
163164

164165
this._store = createRBT(ltgt.compare)
@@ -211,6 +212,13 @@ MemDOWN.prototype._get = function (key, options, callback) {
211212
})
212213
}
213214

215+
MemDOWN.prototype._getMany = function (keys, options, callback) {
216+
this._nextTick(callback, null, keys.map((key) => {
217+
const value = this._store.get(key)
218+
return value === undefined || options.asBuffer ? value : value.toString()
219+
}))
220+
}
221+
214222
MemDOWN.prototype._del = function (key, options, callback) {
215223
this._store = this._store.remove(key)
216224
this._nextTick(callback)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"CONTRIBUTORS.md"
2424
],
2525
"dependencies": {
26-
"abstract-leveldown": "^7.0.0",
26+
"abstract-leveldown": "^7.2.0",
2727
"buffer": "^6.0.3",
2828
"functional-red-black-tree": "^1.0.1",
2929
"inherits": "^2.0.1",

test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ const testCommon = suite.common({
1414
return memdown()
1515
},
1616

17-
// Opt-in to new clear() tests
17+
// Opt-in to new tests
1818
clear: true,
19+
getMany: true,
1920

2021
// Opt-out of unsupported features
2122
createIfMissing: false,

0 commit comments

Comments
 (0)