JSPM

buffer-collections

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 53
  • Score
    100M100P100Q64620F
  • License MIT

A Node.js library to handle Buffer keys in Map, or values in Set, by content instead of the default, by reference.

Package Exports

  • buffer-collections
  • buffer-collections/dist/index.js

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 (buffer-collections) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Buffer Collections

A Node.js library to handle Map<Buffer, V> and Set<Buffer> collections correctly, comparing Buffer keys or items as values (Buffer content) instead of the default comparison by reference.

Installation

npm install buffer-collections

Usage

import { BufferMap } from 'buffer-collections'

const b1 = Buffer.from('CAFE8BCD77AE', 'hex')
const m1 = new BufferMap<string>()
m1.set( b1, 'Some value')

const b2 = Buffer.from(b1) // creates a copy of content of b1, but a different reference

console.log( m1.has(b2)) // true

License

MIT