function
diff.lines
oldText: string,
newText: string,
Compare two strings line by line. A line includes its
or
\r.
@returns
The changes, or undefined if there are more than maxEditLength edits
Bun.diff.lines("a\nb\n", "a\nc\n");
// [
// { value: "a\n", added: false, removed: false, count: 1 },
// { value: "b\n", added: false, removed: true, count: 1 },
// { value: "c\n", added: true, removed: false, count: 1 },
// ]oldText: string,
newText: string,
Compare two strings line by line. A line includes its
or
\r.
@returns
The changes, or undefined if there are more than maxEditLength edits
Bun.diff.lines("a\nb\n", "a\nc\n");
// [
// { value: "a\n", added: false, removed: false, count: 1 },
// { value: "b\n", added: false, removed: true, count: 1 },
// { value: "c\n", added: true, removed: false, count: 1 },
// ]Referenced types
interface Options
- maxEditLength?: number
Return
undefinedwhen the diff adds and removes more than this many tokens in total. An integer from 0, orInfinity.