Skip to content

nunsez/frontend-project-lvl2

Repository files navigation

Hexlet. Gendiff. Frontend project lvl 2.

hexlet-check Node.js CI Maintainability Test Coverage

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.

Install

git clone https://github.com/nunsez/frontend-project-lvl2.git
cd frontend-project-lvl2/
make ci
make link

Run tests

make test
make test-coverage

Gendiff API

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.

Usage examples

Output help information

asciicast

Generate stylish difference between json/yml configs

asciicast

Generate plain difference between yml/json configs

asciicast

Generate json difference between yml/yml configs

asciicast

About

Gendiff - difference generator.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published