Open
Description
I'm trying to build an app that compares typed text to a template and outputs a report to the user. The mockup looks like this:
You typed "Goo dog" and the app tells you that you missed one character ("-" symbol)
So I'm looking into various libraries to compare the strings and prettydiff looks promising.
Essentially I just need that information in a programmable output. I figured out that the json output might be what I want, because I need to apply some post-processing to get that report.
let prettydiff = require("prettydiff");
let options = prettydiff.options;
options.source = 'Good dog';
options.diff = 'Goo dog';
options.mode = 'diff'
options.language = 'text';
options.diff_format = 'json'
options.report = true;
let output = prettydiff();
console.log(output);
Which gives me the following output:
{
"diff":[
[
"r",
"Good dog",
"Goo dog"
]
]
}
I'm not sure if I missed something, but that essentially contains no information about what's different? Is there any other way to get that output?
Metadata
Metadata
Assignees
Labels
No labels