UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

25 lines (24 loc) 891 B
/** * @description Operations for combining patches together, combining operations * together, and cleaning up operations. */ import type { Patch } from './Patch'; /** * Combines two or more patches together. The first patch is modified in place. * Operations from the second patch are appended to the first patch as is * (without cloning). * * The patches must have the same `sid`. The first patch must have lower logical * time than the second patch, and the logical times must not overlap. * * @param patches The patches to combine. */ export declare const combine: (patches: Patch[]) => void; /** * Compacts operations within a patch. Combines consecutive string inserts. * Mutates the operations in place. (Use `patch.clone()` to avoid mutating the * original patch.) * * @param patch The patch to compact. */ export declare const compact: (patch: Patch) => void;