// aliasing for brevity constu8 = Uint8Array, eq = assertEquals
eq(unpack( "bool", // type of value to decode u8.of(1, 0, 1), // buffer to decode from 1, // the index to begin decoding from ), [ false, // returned decoded value 1, // number of bytes traversed while decoding (i.e. byte size of the decoded object) ])
a buffer decoder/unpacker for a primitive value of a certain
type
(see PrimitiveType). this is the inverse of pack.under the hood, this function calls one of the following primitive value decoders, based on the
type
that you provide:Example