jsdiff icon indicating copy to clipboard operation
jsdiff copied to clipboard

A simple few-line example of what to import?

Open Pomax opened this issue 1 year ago • 1 comments

The readme convers how to install it, and the API that you get on the Diff object, but it seems to be missing the part in between those two on how to actually import the thing you'll be working with. Even just a seemingly silly sentence like:

then import the diffing object using import Diff from "diff";

would fill the gap that currently exists =)

(because is it import Diff? import { Diff }? import diff from "diff"; const Diff = diff.newDiff()? Most folks can guess at what it should be of course, especially with typehint aware editors, but they shouldn't need to guess =)

Pomax avatar Jun 01 '24 09:06 Pomax

struggled with that as well... for me import { diffWords } from 'diff' worked.

jzillmann avatar Aug 02 '24 20:08 jzillmann

Added: https://github.com/kpdecker/jsdiff?tab=readme-ov-file#imports

ExplodingCabbage avatar Apr 30 '25 11:04 ExplodingCabbage