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 @@ -284,6 +284,7 @@ class MemoryLevel extends AbstractLevel {
284
284
permanence : false ,
285
285
createIfMissing : false ,
286
286
errorIfExists : false ,
287
+ has : true ,
287
288
encodings : { [ storeEncoding ] : true } ,
288
289
signals : {
289
290
// Would have no value here because the operations are synchronous
@@ -313,6 +314,20 @@ class MemoryLevel extends AbstractLevel {
313
314
return keys . map ( key => this [ kTree ] . get ( key ) )
314
315
}
315
316
317
+ async _has ( key , options ) {
318
+ const tree = options . snapshot != null
319
+ ? options . snapshot [ kTree ]
320
+ : this [ kTree ]
321
+ return tree . get ( key ) !== undefined
322
+ }
323
+
324
+ async _hasMany ( keys , options ) {
325
+ const tree = options . snapshot != null
326
+ ? options . snapshot [ kTree ]
327
+ : this [ kTree ]
328
+ return keys . map ( has , tree )
329
+ }
330
+
316
331
async _del ( key , options ) {
317
332
this [ kTree ] = this [ kTree ] . remove ( key )
318
333
}
@@ -394,3 +409,7 @@ if (typeof process !== 'undefined' && !process.browser && typeof global !== 'und
394
409
function isRangeOption ( k ) {
395
410
return rangeOptions . has ( k )
396
411
}
412
+
413
+ function has ( key ) {
414
+ return this . get ( key ) !== undefined
415
+ }
You can’t perform that action at this time.
0 commit comments