json-joy
Version:
Collection of libraries for building collaborative editing apps.
16 lines (15 loc) • 868 B
TypeScript
import type { StringOp, StringOpComponent } from './types';
export declare const append: (op: StringOp, component: StringOpComponent) => void;
export declare const componentLength: (component: StringOpComponent) => number;
export declare const isDeleteComponent: (component: StringOpComponent) => boolean;
export declare const trim: (op: StringOp) => void;
export declare const normalize: (op: StringOp) => StringOp;
/**
* 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: StringOpComponent, offset: number, maxLength: number) => StringOpComponent;