Function
optionalField
(
value: T | undefined,
encode: (v: T) => Uint8Array
)
Source from the content-addressed store, hash-verified
| 206 | * Helper to conditionally encode an optional field |
| 207 | */ |
| 208 | export const optionalField = <T>( |
| 209 | value: T | undefined, |
| 210 | encode: (v: T) => Uint8Array |
| 211 | ): Uint8Array => value !== undefined ? encode(value) : new Uint8Array(0) |
| 212 | |
| 213 | /** |
| 214 | * Helper to conditionally encode a string field if non-empty |
Callers
nothing calls this directly
Tested by
no test coverage detected