align-arr
Version:
Find the minimal edit path between two generic arrays.
14 lines (13 loc) • 541 B
TypeScript
import { Aligner } from './types';
/**
* Computes the minimal edit path (Levenshtein distance) between two arrays.
* Returns an array of edit operations (alignment) to transform source into target.
*
* @template S - Source element type
* @template T - Target element type
* @param {S[]} s - Source array
* @param {T[]} t - Target array
* @param {AlignerConfig<S, T>} [config] - Optional configuration for custom costs and equality
* @returns {Edit<S, T>[]} The alignment (edit script)
*/
export declare const levenshtein: Aligner;