json-joy
Version:
Collection of libraries for building collaborative editing apps.
16 lines (15 loc) • 868 B
TypeScript
import type { BinaryOp, BinaryOpComponent } from './types';
export declare const append: (op: BinaryOp, component: BinaryOpComponent) => void;
export declare const componentLength: (component: BinaryOpComponent) => number;
export declare const isDeleteComponent: (component: BinaryOpComponent) => boolean;
export declare const trim: (op: BinaryOp) => void;
export declare const normalize: (op: BinaryOp) => BinaryOp;
/**
* Extracts a full or a part of a component from an operation.
*
* @param component Component from which to extract a chunk.
* @param offset Position within the component to start from.
* @param maxLength Maximum length of the component to extract.
* @returns Full or partial component at index `index` of operation `op`.
*/
export declare const chunk: (component: BinaryOpComponent, offset: number, maxLength: number) => BinaryOpComponent;