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 18 19 20 21 22 | 19x 19x 2x 9x 9x 9x 306x 3x 3x 3x 203x 3x | import { asyncDefine } from "../asyncDefine"; import { AsyncArrayFactory } from "../types"; export const asyncArray: AsyncArrayFactory = (sd, headSd) => asyncDefine( async (ctx, data) => { const { length } = data; headSd.ser(ctx, length); for (let i = 0; i < length; i++) { await sd.ser(ctx, data[i]); } }, async (ctx) => { const length = headSd.des(ctx); const data = []; for (let i = 0; i < length; i++) { data.push(await sd.des(ctx)); } return data; } ); |