Initial Commit

This commit is contained in:
2026-05-27 23:47:53 +01:00
parent fbc70f96e6
commit 9b28db724f
18103 changed files with 1600554 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<!-- begin:auto-docs -->
_(no submodules)_
<!-- end:auto-docs -->
## boolean
**Path:** `bitpacker-strategies/src/strategies/boolean/boolean.ts`
**Export:** See source for details.
### What it does
Packing strategy for @suaveplan/bitpacker.

View File

@@ -0,0 +1,23 @@
import type {
BitPackerSchema,
PackingContext,
PackingStrategy,
} from "@suaveplan/bitpacker";
export class BooleanPackingStrategy implements PackingStrategy {
canHandle(schema: BitPackerSchema): boolean {
return typeof schema === "boolean";
}
pack(
data: unknown,
_schema: BitPackerSchema,
context: PackingContext
): void {
context.writer.writeBool(Boolean(data));
}
unpack(_schema: BitPackerSchema, context: PackingContext): unknown {
return context.reader.readBool();
}
}