@lachenmayer/longest-common-subsequence

1.0.1 • Public • Published

longest-common-subsequence

Finds the longest common subsequence of two strings, and the diff between them.

function lcs(a: string, b: string): { lcs: string, diff: Array<Diff> }

type Diff =
  | ['keepOld', number] // index in a
  | ['addNew', number] // index in b
  | ['removeOld', number] // index in a

/@lachenmayer/longest-common-subsequence/

    Package Sidebar

    Install

    npm i @lachenmayer/longest-common-subsequence

    Weekly Downloads

    3

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    3.53 kB

    Total Files

    4

    Last publish

    Collaborators

    • lachenmayer