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 | 65x 65x 14505x 65x 1278x 175x 175x 175x 175x 175x 1103x | import {type NodeBuilder, s} from '../../../json-crdt-patch'; import type {SliceType, SliceTypeStep} from './types'; export const type = (sliceType: SliceType) => Array.isArray(sliceType) ? s.arr(sliceType.map(step)) : s.con(sliceType); export const step = (sliceStep: SliceTypeStep) => { if (Array.isArray(sliceStep)) { const tuple: NodeBuilder[] = [s.con(sliceStep[0])]; const length = sliceStep.length; if (length > 1) tuple.push(s.con(+(sliceStep[1] ?? 0))); if (length > 2) tuple.push(s.json(sliceStep[2] ?? {})); return s.vec(...tuple); } return s.con(sliceStep); }; |