numeric-id-map
Data structure that maps entries to numeric ids
Last updated 9 years ago by mafintosh .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install numeric-id-map 
SYNC missed versions from official npm registry.

numeric-id-map

Data structure that maps entries to numeric ids

npm install numeric-id-map

build status

Usage

var map = require('numeric-id-map')
var ids = map()

// map an entry to a numeric id
var id = ids.add({hello: 'world'})

// remove an id and get the data back
// the id will be reused for another entry
var entry = map.remove(id)

API

var ids = map()

Create a new instance

id = ids.add(entry)

Map an entry to a numberic id.

entry = ids.remove(id)

Remove an id and return the previously mapped entry. After removing the id might be reused in the future.

entry = ids.get(id)

Lookup a mapped entry by it's id without removing it

License

MIT

Current Tags

  • 1.1.0                                ...           latest (9 years ago)

2 Versions

  • 1.1.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |