https://github.com/fey/frontend-project-lvl2
A program defining the difference between two data structures.
https://github.com/fey/frontend-project-lvl2
Last synced: about 1 year ago
JSON representation
A program defining the difference between two data structures.
- Host: GitHub
- URL: https://github.com/fey/frontend-project-lvl2
- Owner: fey
- Created: 2020-10-10T10:54:23.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-04-18T16:13:32.000Z (over 1 year ago)
- Last Synced: 2025-05-13T00:57:57.393Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Hexlet tests and linter status:

### Description
Gendiff - a program defining the difference between two data structures.
The capabilities of the utility:
* Support for different input formats: yaml, json
* Report generation as plain text, stylish and json
### Requirements
* NodeJS 14+
### Installation
Clone or fork repository
```sh
$ make install # install dependencies
$ make test # run tests
$ make lint # run eslint
```
Usage example:
```sh
$ make setup
# plain
$ gendiff --format plain path/to/file.yml another/path/file.json
Property 'common.follow' was added with value: false
Property 'group1.baz' was updated. From 'bas' to 'bars'
Property 'group2' was removed
# stylish
$ gendiff filepath1.json filepath2.json
{
+ follow: false
setting1: Value 1
- setting2: 200
- setting3: true
+ setting3: {
key: value
}
+ setting4: blah blah
+ setting5: {
key5: value5
}
}
```
Importing
```js
import genDiff from '@hexlet/code';
const diff = genDiff(filepath1, filepath2);
console.log(diff);
```
### asciinema
Parse with default output
https://asciinema.org/a/gpZ9rKPFuXQGoJddd3xQ2y2n3
Parse with plain output
https://asciinema.org/a/oLndW0cO8KUM77GxVrpCp8IUK
Parse with json output
https://asciinema.org/a/OISoLtILjt7cUMROL8q6HMs1b