API reference@evolu/commonlocal‑first/Protocol › decodeFlags

function decodeFlags(
  buffer: Buffer,
  count: number &
    Brand<"NonNaN"> &
    Brand<"Finite"> &
    Brand<"Int"> &
    Brand<"NonNegative"> &
    Brand<"Positive">,
): readonly boolean[];

Defined in: packages/common/src/local-first/Protocol.ts:1831

Decodes a byte into an array of boolean flags.

Example

import { assertEqual, createBuffer, PositiveInt } from "@evolu/common";
import { decodeFlags } from "@evolu/common/local-first";

const buffer = createBuffer([0b101]);
const flags = decodeFlags(buffer, PositiveInt.orThrow(3));

assertEqual(flags, [true, false, true]);
assertEqual(buffer.getLength(), 0);