json-joy
Version:
Collection of libraries for building collaborative editing apps.
15 lines (14 loc) • 520 B
TypeScript
import type { BinaryOp } from './types';
/**
* Transforms an operation such that the transformed operations can be
* applied in a reverse order.
*
* ```
* apply(apply(doc, op1), transform(op2, op1)) === apply(apply(doc, op2), transform(op1, op2))
* ```
*
* @param op1 The operation to transform.
* @param op2 The operation to transform against.
* @returns A new operation with user intentions preserved.
*/
export declare const transform: (op1: BinaryOp, op2: BinaryOp, leftInsertFirst: boolean) => BinaryOp;