@n1ru4l/json-patch-plus
Version:
This is a slimmed version of [jsondiffpatch](https://github.com/benjamine/jsondiffpatch). All the code is taken from the [jsondiffpatch](https://github.com/benjamine/jsondiffpatch) repository, slimmed down, slightly altered and converted to TypeScript.
20 lines (19 loc) • 1.04 kB
TypeScript
/**
* LCS implementation that supports arrays or strings
*
* reference: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
*/
export declare function defaultMatch(array1: Array<unknown>, array2: Array<unknown>, index1: number, index2: number): boolean;
declare type MatchFunction = (array1: Array<unknown>, array2: Array<unknown>, index1: number, index2: number, context?: unknown) => boolean | undefined;
declare type Matrix = Array<number | Array<number>> & {
match: MatchFunction;
};
export declare function lengthMatrix(array1: Array<unknown>, array2: Array<unknown>, match: MatchFunction, context?: unknown): Matrix;
declare type Subsequence = {
sequence: Array<unknown>;
indices1: Array<number>;
indices2: Array<number>;
};
export declare function backtrack(matrix: Matrix, array1: Array<unknown>, array2: Array<unknown>, context?: unknown): Subsequence;
export declare function get(array1: Array<unknown>, array2: Array<unknown>, match: MatchFunction, context?: unknown): Subsequence;
export {};