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 17 | 19x 19x 1x 2x 1x 1x 1x 2x | import { asyncDefine } from "../asyncDefine"; import { AsyncOptionalFactory } from "../types"; export const asyncOptional: AsyncOptionalFactory = (sd) => asyncDefine( async (ctx, data) => { if (data == undefined) { ctx.view.setUint8(ctx.i++, 0); } else { ctx.view.setUint8(ctx.i++, 1); await sd.ser(ctx, data); } }, async (ctx) => ctx.view.getUint8(ctx.i++) ? await sd.des(ctx) : undefined ); |