Skip to content

alex-kurkov/frontend-project-lvl2

Repository files navigation

Gendiff.js

FRONTEND-PROJECT Lvl 2

Hexlet tests and linter status:

hexlet-check Maintainability Test Coverage Node CI

Content


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

Installation

  • 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');

Getting help

gendiff --help

or

gendiff -h

Usage

When used on command line type

gendiff ./path/to/myfile1.json ./path/to/myfile2.json

(example ASCIINEMA)

Setting output format

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

Supported input file types

Gendiff supports json yml yaml files (example comparing yaml files ASCIINEMA)

Formats supported are 'json', 'yaml', 'yml', plain text


connect me via email

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published