Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 19x 19x 2x 336x 192x 144x 144x 204x | import { define } from "../define";
import { OptionalFactory } from "../types";
export const optional: OptionalFactory = (sd) =>
define(
(ctx, data) => {
if (data == undefined) {
ctx.view.setUint8(ctx.i++, 0);
} else {
ctx.view.setUint8(ctx.i++, 1);
sd.ser(ctx, data);
}
},
(ctx) => (ctx.view.getUint8(ctx.i++) ? sd.des(ctx) : undefined)
);
|