Modify a level(up) datastore to treat a null "put" as a "del"
A small patch to a levelup database object, so that you can use a single
put style interface for additions, modifications, and deletions.
var levelup = ;var nulldel = ;var db = ;db; // unaffecteddb; // stores null as value; // monkey-patches this db objectdb; // unaffected, changes to bardb; // deletes somekey
It unifies "change" requests, just as access requests all use
This can simplify your code, and everything built on top of it.
Note that this prevents storing
null as value with JSON encoding (
was already a no-no). For simple string encodings you can still use
empty string) as value to represent emptiness.
This module was suggested by Rod Vagg, levelup's author, in a brief discussion on github, issue #191.