Skip to content

Commit b5f5c52

Browse files
authored
Implement db.getSync() (#21)
Ref: Level/community#144 Category: addition
1 parent 2a0c353 commit b5f5c52

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class MemoryLevel extends AbstractLevel {
3737
createIfMissing: false,
3838
errorIfExists: false,
3939
has: true,
40+
getSync: true,
4041
encodings: { [storeEncoding]: true },
4142
signals: {
4243
// Would have no value here because the operations are synchronous
@@ -62,6 +63,11 @@ class MemoryLevel extends AbstractLevel {
6263
return tree.get(key)
6364
}
6465

66+
_getSync (key, options) {
67+
const tree = options.snapshot?.[kTree] ?? this.#tree
68+
return tree.get(key)
69+
}
70+
6571
async _getMany (keys, options) {
6672
const tree = options.snapshot?.[kTree] ?? this.#tree
6773
return keys.map(get, tree)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"CHANGELOG.md"
2121
],
2222
"dependencies": {
23-
"abstract-level": "^3.0.1",
23+
"abstract-level": "^3.1.0",
2424
"functional-red-black-tree": "^1.0.1",
2525
"module-error": "^1.0.1"
2626
},

0 commit comments

Comments
 (0)