Text diff library exported from monaco-editor-core, which is core of VS Code.
npm install monaco-diff
import { diff, linesDiff } from "monaco-diff";
console.log(
diff(
"just some text\n\nHello World\n\nSome more text".split("\n"),
"just some Text\n\nHello World\n\nSome more changes".split("\n")
)
);
console.log(
linesDiff(
"just some text\n\nHello World\n\nSome more text".split("\n"),
"just some Text\n\nHello World\n\nSome more changes".split("\n")
)
);