This is my second JavaScript project based on Hexlet backend courses. I built a difference generator for json, yaml and ini files.
git clone git@github.com:gomez-git/backend-project-lvl2.git
cd backend-project-lvl2
make install
make test
gendiff -h
You can use it as a script in terminal or as a library in your JavaScript project. It supports json, yaml and ini files. You can format difference in three styles: stylish (default), plain and json. You can choose replacer: ' ' (default) or custom replacer and one of three sort orders: asc (default), desc and none.
In terminal:
Install dependencies with command make install
in directory with my project.
$ gendiff -h
Usage: gendiff [options] <filepath1> <filepath2>
Compares two configuration files and shows a difference.
Options:
-v, --version output the version number
-f, --format <type> output format (choices: "plain", "json", default: "stylish")
-r, --replacer <char> output replacer (default: " ")
-s, --sort-order <type> output sort (choices: "desc", "none", default: "asc")
-h, --help output usage information
In your project:
Install my package with:
npm install https://github.com/gomez-git/backend-project-lvl2
Try it in your project:
import genDiff from '@hexlet/code';
const diff = genDiff(filepath1, filepath2[, { format, replacer, sortOrder }]);
console.log(diff);