JSPM

numeric-id-map

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4168
  • Score
    100M100P100Q125279F
  • License MIT

Data structure that maps entries to numeric ids

Package Exports

  • numeric-id-map

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (numeric-id-map) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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