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 23 24 25 26 27 28 29 30 31 32 | 4x 4x 424x 424x 17127x 424x 4x 212x 212x 8560x 212x 4x 107x 107x 107x 4x 3x 104x 104x | import * as str from './str'; export const toStr = (buf: Uint8Array): string => { let hex = ''; const length = buf.length; for (let i = 0; i < length; i++) hex += String.fromCharCode(buf[i]); return hex; }; export const toBin = (hex: string): Uint8Array => { const length = hex.length; const buf = new Uint8Array(length); for (let i = 0; i < length; i++) buf[i] = hex.charCodeAt(i); return buf; }; export const diff = (src: Uint8Array, dst: Uint8Array): str.Patch => { const txtSrc = toStr(src); const txtDst = toStr(dst); return str.diff(txtSrc, txtDst); }; export const apply = ( patch: str.Patch, srcLen: number, onInsert: (pos: number, str: Uint8Array) => void, onDelete: (pos: number, len: number) => void, ) => str.apply(patch, srcLen, (pos, str) => onInsert(pos, toBin(str)), onDelete); export const src = (patch: str.Patch): Uint8Array => toBin(str.src(patch)); export const dst = (patch: str.Patch): Uint8Array => toBin(str.dst(patch)); |