(isEquivalent: (self: A, that: A) => boolean)
| 195 | * @since 4.0.6 |
| 196 | */ |
| 197 | export const diffWith = <A>(isEquivalent: (self: A, that: A) => boolean) => |
| 198 | ( |
| 199 | before: ReadonlyArray<A>, |
| 200 | after: ReadonlyArray<A>, |
| 201 | options?: { |
| 202 | /** |
| 203 | * Largest number of inserted plus deleted items searched for in each |
| 204 | * changed region. Common prefixes, suffixes and matching runs are free. |
| 205 | * When a region needs more edits, the search splits it at the furthest |
| 206 | * point it reached and continues on the rest, and a part that still cannot |
| 207 | * be matched becomes a deletion followed by an insertion. The script stays |
| 208 | * valid, and is minimal whenever the whole diff needs at most `maxEdits` |
| 209 | * edits. For a finite cap, work is O((N + M) * (maxEdits + 1)). |
| 210 | * |
| 211 | * @default Infinity |
| 212 | */ |
| 213 | readonly maxEdits?: number | undefined |
| 214 | } |
| 215 | ): Array<Edit<A>> => editScript(before, after, (i, j) => isEquivalent(before[i], after[j]), options?.maxEdits) |
| 216 | |
| 217 | /** |
| 218 | * Computes a minimal edit script between two arrays, comparing items with |
no test coverage detected