FRONTEND-PROJECT Lvl 2
Gendiff is a simple application comparing and showing difference between 2 configuration files. Gendiff can be used either as a js-library or as a Cli-utility run on Node.js
- To install locally clone repository to your directory
git clone https://github.com/alex-kurkov/frontend-project-lvl2.git
- Run
cd frontend-project-lvl2
npm install
npm link
After local installation to use as a js-library import gendiff in your js-module
// ES6 style
import genDiff from 'gendiff.js';
// or in < ES6 style
const genDiff = require('./gendiff');
gendiff --help
or
gendiff -h
When used on command line type
gendiff ./path/to/myfile1.json ./path/to/myfile2.json
(example ASCIINEMA)
Output format can be set by using -f
or --format
flag when using on command line
gendiff ./path/to/myfile1.json ./path/to/myfile2.json --format json
Example of json output
or may be specified as the third parameter when used as a js-library function. In this case it should be string
import genDiff from 'gendiff';
const diff = genDiff(filepath1, filepath2, 'plain');
console.log(diff);
Gendiff supports output in json
, stylish
or plain
formats. stylish
is set by default. Example of plain
and 'stylish' output
Gendiff supports json
yml
yaml
files
(example comparing yaml
files ASCIINEMA)
Formats supported are 'json'
, 'yaml'
, 'yml'
, plain text