2.0.1 • Published 1 year ago

@chainsafe/pubkey-index-map v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@chainsafe/pubkey-index-map

Small napi-rs shim with an interface similar to Map<Uint8Array, number> but only for length 48 Uint8Arrays for keys and unsigned 32 bit numbers for values.

import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"

// instantiate a new map
let map = new PubkeyIndexMap()

const pubkey: Uint8Array = ...;
const index: number = ...;

// Add a pubkey, index to the map
map.set(pubkey, index)

// Get an index from the map
map.get(pubkey) === index

// Delete a pubkey from the map
map.delete(pubkey)

// Clear the map
map.clear()

// Check the size of the map
map.size === 0

License

MIT

2.0.1

1 year ago

2.0.0

1 year ago

1.0.0

1 year ago