File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 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 {
290290 permanence : false ,
291291 createIfMissing : false ,
292292 errorIfExists : false ,
293+ has : true ,
293294 encodings : { [ storeEncoding ] : true } ,
294295 signals : {
295296 // Would have no value here because the operations are synchronous
@@ -327,6 +328,20 @@ class MemoryLevel extends AbstractLevel {
327328 return keys . map ( getFromThis , tree )
328329 }
329330
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+
330345 async _del ( key , options ) {
331346 this [ kTree ] = this [ kTree ] . remove ( key )
332347 }
@@ -423,3 +438,7 @@ function getFromThis (key) {
423438function isRangeOption ( k ) {
424439 return rangeOptions . has ( k )
425440}
441+
442+ function has ( key ) {
443+ return this . get ( key ) !== undefined
444+ }
You can’t perform that action at this time.
0 commit comments