UNPKG

lib0

Version:

isomorphic utility functions

25 lines • 923 B
export function diff(as: Array<string>, bs: Array<string>, leftmost?: boolean): Array<{ index: number; remove: Array<string>; insert: Array<string>; }>; export function diffSplitBy(a: string, b: string, regexp: RegExp | string): { index: number; remove: string; insert: string; }[]; /** * Idea: match all "non-word" characters and keep them separate (spaces, comma, exclamation marks, ..). * Anything that can be classivied as a word (emoji, char, number) will be bundled together. All other tokens are kept * individually. "hello, world!!!!" => ['hello', ',', ' ', 'world', '!', '!'] * * @experimental */ export const smartSplitRegex: RegExp; export function diffAuto(a: string, b: string): { insert: string; remove: string; index: number; }[]; export function splitByRegexp(str: string, regexp: RegExp, includeSeparator: boolean): string[]; //# sourceMappingURL=patience.d.ts.map