MCPcopy Create free account
hub / github.com/Effect-TS/effect / diff

Function diff

packages/effect/src/TextDiff.ts:246–263  ·  view source on GitHub ↗
(
  before: ReadonlyArray<A>,
  after: ReadonlyArray<A>,
  options?: {
    /**
     * Largest number of inserted plus deleted items searched for in each
     * changed region. Common prefixes, suffixes and matching runs are free.
     * When a region needs more edits, the search splits it at the furthest
     * point it reached and continues on the rest, and a part that still cannot
     * be matched becomes a deletion followed by an insertion. The script stays
     * valid, and is minimal whenever the whole diff needs at most `maxEdits`
     * edits. For a finite cap, work is O((N + M) * (maxEdits + 1)).
     *
     * @default Infinity
     */
    readonly maxEdits?: number | undefined
  }
)

Source from the content-addressed store, hash-verified

244 * @since 4.0.6
245 */
246export const diff = <A>(
247 before: ReadonlyArray<A>,
248 after: ReadonlyArray<A>,
249 options?: {
250 /**
251 * Largest number of inserted plus deleted items searched for in each
252 * changed region. Common prefixes, suffixes and matching runs are free.
253 * When a region needs more edits, the search splits it at the furthest
254 * point it reached and continues on the rest, and a part that still cannot
255 * be matched becomes a deletion followed by an insertion. The script stays
256 * valid, and is minimal whenever the whole diff needs at most `maxEdits`
257 * edits. For a finite cap, work is O((N + M) * (maxEdits + 1)).
258 *
259 * @default Infinity
260 */
261 readonly maxEdits?: number | undefined
262 }
263): Array<Edit<A>> => diffWith<A>(Equal.equals)(before, after, options)
264
265/**
266 * Computes a minimal line-level edit script between two strings.

Callers

nothing calls this directly

Calls 1

diffWithFunction · 0.85

Tested by

no test coverage detected