This is the second project from Hexlet Frontend Program.
Demonstration of gendiff on Replit
This utility compares two files and generates their difference. Structures can be deep.
Supports .json, .yaml or .ini as inputs.
Can output in:
stylish- readable united structure that marks changes with+and-signs (this is default option),plain- description of properties that were added, removed or updated,json- string with json formatting.
1. compare flat json files
2. compare flat yaml files
3. compare flat ini files
4. output to stylish
5. output to plain
6. output to json
- Clone this repository to your filesystem:
git clone https://github.com/dpetruk/frontend-project-lvl2.git- Go to directory
frontend-project-lvl2and create links:
npm linkgendiff <filename1> <filename2>-f, --format - specify output format (stylish - default, plain or json).
-h, --help - get help.
import genDiff from 'gendiff';// outputFormat can be 'stylish', 'plain' or 'json'. Default option is 'stylish'.
const diff = genDiff(filepath1, filepath2, outputFormat);
console.log(diff);




