Socket
Socket
Sign inDemoInstall

level-enumerate

Package Overview
Dependencies
2
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    level-enumerate

Enumerate keys to incrementing numbers


Version published
Weekly downloads
8
decreased by-52.94%
Maintainers
1
Install size
13.1 kB
Created
Weekly downloads
 

Readme

Source

level-enumerate

Enumerate keys to incrementing numbers. If you enumerate the same key twice it will enumerate to the same value.

npm install level-enumerate

build status

Usage

var 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
    })
  })
})

API

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
}

License

MIT

FAQs

Last updated on 07 Feb 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc