@launchmenu/core
Version:
An environment for visual keyboard controlled applets
31 lines • 1.99 kB
TypeScript
import { ITextAlterationInput } from "./_types/ITextAlterationInput";
export declare namespace TextAlterationTools {
/**
* Combines the given text alterations that were executed after the base alterations, to be in the form of the base alterations to be executable at the same time
* @param base The base alterations in sorted order
* @param alterations The alterations to merge with the base alterations
* @param rebase Whether to rebase the alterations to be from the base's perspective, to be used when the alterations were made after the base changes were applied
* @returns The alterations that can all be made at once to obtain an equivalent result
*
* @remarks This function is kind of thrown together. The logic hasn't been verified by anything else than a number of unit tests. It would be nice if we can find a cleaner proven algorithm sometime.
*/
function mergeAlterations(base: ITextAlterationInput[], alterations: ITextAlterationInput[], rebase?: boolean): ITextAlterationInput[];
/**
* Merges consecutive alterations together when possible
* @param alterations The alterations to be merged
* @returns The merged alterations
*/
function mergeConsecutiveAlteration(alterations: ITextAlterationInput[]): ITextAlterationInput[];
/**
* Performs the specified alterations on a piece of text
* @param text The text to perform the alterations on
* @param alterations The alterations to perform, in sorted order
* @returns The obtained text
*
* @remarks
* Since this currently just uses string concatenation, it's not super efficient for big input.
* In the future arrays and join could be used, making it faster for big inputs, but it would make things slower for small inputs.
*/
function performAlterations(text: string, alterations: ITextAlterationInput[]): string;
}
//# sourceMappingURL=TextAlterationTools.d.ts.map