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

Function codePoints

packages/effect/src/TextDiff.ts:337–350  ·  view source on GitHub ↗
(before: string, after: string, 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

335 * @since 4.0.6
336 */
337export const codePoints = (before: string, after: string, options?: {
338 /**
339 * Largest number of inserted plus deleted items searched for in each
340 * changed region. Common prefixes, suffixes and matching runs are free.
341 * When a region needs more edits, the search splits it at the furthest
342 * point it reached and continues on the rest, and a part that still cannot
343 * be matched becomes a deletion followed by an insertion. The script stays
344 * valid, and is minimal whenever the whole diff needs at most `maxEdits`
345 * edits. For a finite cap, work is O((N + M) * (maxEdits + 1)).
346 *
347 * @default Infinity
348 */
349 readonly maxEdits?: number | undefined
350}): Array<Edit<string>> => diffStrings(Array.from(before), Array.from(after), options?.maxEdits)
351
352/**
353 * Applies an edit script to an array.

Callers 1

inlineRangesFunction · 0.70

Calls 2

diffStringsFunction · 0.85
fromMethod · 0.80

Tested by

no test coverage detected