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 @@ -284,6 +284,7 @@ class MemoryLevel extends AbstractLevel {
284284 permanence : false ,
285285 createIfMissing : false ,
286286 errorIfExists : false ,
287+ has : true ,
287288 encodings : { [ storeEncoding ] : true } ,
288289 signals : {
289290 // Would have no value here because the operations are synchronous
@@ -313,6 +314,20 @@ class MemoryLevel extends AbstractLevel {
313314 return keys . map ( key => this [ kTree ] . get ( key ) )
314315 }
315316
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+
316331 async _del ( key , options ) {
317332 this [ kTree ] = this [ kTree ] . remove ( key )
318333 }
@@ -394,3 +409,7 @@ if (typeof process !== 'undefined' && !process.browser && typeof global !== 'und
394409function isRangeOption ( k ) {
395410 return rangeOptions . has ( k )
396411}
412+
413+ function has ( key ) {
414+ return this . get ( key ) !== undefined
415+ }
You can’t perform that action at this time.
0 commit comments