index-encoder

3.3.1 • Public • Published

index-encoder

Encode multiple values into sorted keys

npm install index-encoder

Usage

const IndexEncoder = require('index-encoder')

const idx = new IndexEncoder([
  IndexEncoder.STRING,
  IndexEncoder.UINT
])

const buf = idx.encode(['foo', 42])
console.log(idx.decode(buf)) // ['foo', 42]

// pass any compact encoding name to map it to the relevant encoding
const uintType = IndexEncoder.lookup('uint')
const bufferType = IndexEncoder.lookup('buffer')
const alsoBufferType = IndexEncoder.lookup('fixed32')

License

Apache 2.0

Readme

Keywords

none

Package Sidebar

Install

npm i index-encoder

Weekly Downloads

394

Version

3.3.1

License

Apache-2.0

Unpacked Size

24.4 kB

Total Files

7

Last publish

Collaborators

  • mafintosh