https://github.com/timursus/differencecalculator
Compare configuration files
https://github.com/timursus/differencecalculator
cli comparison hexlet-projects jest nodejs testing trees utility
Last synced: 2 months ago
JSON representation
Compare configuration files
- Host: GitHub
- URL: https://github.com/timursus/differencecalculator
- Owner: timursus
- Created: 2020-03-29T16:27:22.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T18:19:12.000Z (over 3 years ago)
- Last Synced: 2025-03-12T11:18:31.145Z (about 1 year ago)
- Topics: cli, comparison, hexlet-projects, jest, nodejs, testing, trees, utility
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@timursus/gendiff
- Size: 1.91 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Difference calculator
[](https://github.com/timursus/frontend-project-lvl2/actions)
[](https://codeclimate.com/github/timursus/frontend-project-lvl2/maintainability)
[](https://codeclimate.com/github/timursus/frontend-project-lvl2/test_coverage)
Compares two configuration files and shows a difference.
- Supports different data formats: JSON, YAML, INI.
- Shows a report in plain text, pretty, or json formats.
- Works as CLI utility or as node.js module.
## Getting started
```bash
npm install -g @timursus/gendiff
```
> Requires [Node](https://nodejs.org/) v13+
## Usage
```
gendiff [options]
Options:
-h, --help display help for command
-V, --version output the version number
-f, --format output format [pretty, plain, json] (default: "pretty")
--color enable color highlighting for "pretty" or "plain" output
```
## Demonstrations of use
Comparison of nested structures. Color output.
[](https://asciinema.org/a/FOPjvaMJ5HAkFHHOmiwnIzHcc)
### API
**gendiff (filepath1, filepath2 [, outputFormat = 'json'])**
By default, `gendiff` returns a diff tree in json string
``` javascript
import gendiff from '@timursus/gendiff';
const diff = gendiff(filepath1, filepath2);
```