Gendiff - a program that calculates the difference between two data structures. This is a popular problem, for which there are many online services (JSON Diff). A similar mechanism, for example, is used when outputting tests or when automatically tracking changes in configuration files.
Utility features:
- Support for different input formats: yaml, json.
- Generating a report in plain text, stylish and json format.
git clone https://github.com/nunsez/frontend-project-lvl2.git
cd frontend-project-lvl2/
make ci
make link
make test
make test-coverage
You can import the utility as a function:
import gendiff from 'gendiff';
const difference = gendiff(filepath1, filepath2, formatName);
First two arguments <filepath1>
and <filepath2>
are paths to files you want to compare. They are required.
The third argument [formatName]
is a string and is optional. It determines how the result is displayed. List of supported formats:
stylish
(uses as default format)plain
json
Json is a structured format. It allows other programs to use the output for their work.