Package Exports
- @minhducsun2002/leb128
- @minhducsun2002/leb128/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 (@minhducsun2002/leb128) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
leb128
A parser for LEB128-formatted numbers.
Usage
// ES6 imports
import { LEB128 } from '@minhducsun2002/leb128';
// CommonJS thingy
const { LEB128 } = require('@minhducsun2002/leb128');
// Unsigned integers
var a = LEB128.encode(462644);
// Uint8Array (3) [ 180, 158, 28 ]
var b = LEB128.decode(a);
// 462644
var c = LEB128.decode([0xA6, 0x87, 0x90, 0x04])
// 8651686
// Signed (negative) integers
var d = LEB128.encode(-128383);
// Uint8Array(3) [ 129, 149, 120 ]
var e = LEB128.decode(d, 0, true); /* offset = 0, negative number */
// 8651686
var f = LEB128.decode([0x01, 0x81, 0x95, 0x78], 1, true)
// -128383
License
MIT License. See here