Skip to content

Commit

Permalink
feat: publish deserializeUint8ArrayBitListFromBytes
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Sep 14, 2023
1 parent c575baa commit f4d9002
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/ssz/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Types
export {BitListType} from "./type/bitList";
export {BitListType, deserializeUint8ArrayBitListFromBytes} from "./type/bitList";
export {BitVectorType} from "./type/bitVector";
export {BooleanType} from "./type/boolean";
export {ByteListType} from "./type/byteList";
Expand Down
6 changes: 5 additions & 1 deletion packages/ssz/src/type/bitList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ export class BitListType extends BitArrayType {

type BitArrayDeserialized = {uint8Array: Uint8Array; bitLen: number};

function deserializeUint8ArrayBitListFromBytes(data: Uint8Array, start: number, end: number): BitArrayDeserialized {
export function deserializeUint8ArrayBitListFromBytes(
data: Uint8Array,
start: number,
end: number
): BitArrayDeserialized {
if (end > data.length) {
throw Error(`BitList attempting to read byte ${end} of data length ${data.length}`);
}
Expand Down

0 comments on commit f4d9002

Please sign in to comment.