File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -290,6 +290,7 @@ class MemoryLevel extends AbstractLevel {
290
290
permanence : false ,
291
291
createIfMissing : false ,
292
292
errorIfExists : false ,
293
+ has : true ,
293
294
encodings : { [ storeEncoding ] : true } ,
294
295
signals : {
295
296
// Would have no value here because the operations are synchronous
@@ -327,6 +328,20 @@ class MemoryLevel extends AbstractLevel {
327
328
return keys . map ( getFromThis , tree )
328
329
}
329
330
331
+ async _has ( key , options ) {
332
+ const tree = options . snapshot != null
333
+ ? options . snapshot [ kTree ]
334
+ : this [ kTree ]
335
+ return tree . get ( key ) !== undefined
336
+ }
337
+
338
+ async _hasMany ( keys , options ) {
339
+ const tree = options . snapshot != null
340
+ ? options . snapshot [ kTree ]
341
+ : this [ kTree ]
342
+ return keys . map ( has , tree )
343
+ }
344
+
330
345
async _del ( key , options ) {
331
346
this [ kTree ] = this [ kTree ] . remove ( key )
332
347
}
@@ -423,3 +438,7 @@ function getFromThis (key) {
423
438
function isRangeOption ( k ) {
424
439
return rangeOptions . has ( k )
425
440
}
441
+
442
+ function has ( key ) {
443
+ return this . get ( key ) !== undefined
444
+ }
You can’t perform that action at this time.
0 commit comments