package
Enumerate keys to incrementing numbers
npm install level-enumerateGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 3 packages.
8.5 kB
Includes dependencies.
Enumerate keys to incrementing numbers. If you enumerate the same key twice it will enumerate to the same value.
npm install level-enumeratevar enumerator = require('level-enumerate')
var enumerate = enumerator(db) // where db is a levelup
enumerate('hello', function (err, value) {
console.log(value) // prints 0
enumerate('hello', function (err, value) {
console.log(value) // prints 0 again
enumerate('world', function (err, value) {
console.log(value) // prints 1
})
})
})enumerate = enumerator(db, [options])Create a new enumerator. Options include
{
sep: '!' // the separator used when storing the key values
prefix: ... // optional string prefix to use when keys when stored
}MIT