Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tr3nbolon3/diffcalculus


https://github.com/tr3nbolon3/diffcalculus

diff file-differences functional-programming ini json yaml yml

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# Вычислитель отличий
[![Maintainability](https://api.codeclimate.com/v1/badges/1cf9581b08325df5bc71/maintainability)](https://codeclimate.com/github/Haliont/diffcalculus/maintainability)

[![Build Status](https://travis-ci.org/Haliont/diffcalculus.svg?branch=master)](https://travis-ci.org/Haliont/diffcalculus)

CLI-приложение, принимает 2 файла, сравнивает их и выводит различия.

## Установка
```npm install -g diffcalculus```

## Использование
```
Usage: gendiff [options]

Compares two configuration files and shows a difference.

Options:

-V, --version output the version number
-f, --format [type] Output format
-h, --help output usage information
```

типы поддерживаемых файлов: *.ini, *.json, *.yml

типы вывода дифа: standart (по умолчанию), plain, json

## Использоание как библиотеки
```npm install --save-dev diffcalculus```
```
import genDiff from 'diffcalculus';
const diff = genDiff(, )
console.log(diff);
```

## Примеры вывода
### standart:
```
{
common: {
setting1: Value 1
- setting2: 200
+ setting3: {
key: value
}
- setting3: true
setting6: {
key: value
+ ops: vops
}
+ setting4: blah blah
+ setting5: {
key5: value5
}
}
+ follow: false
}
```

### plain:
```
Property 'timeout' was updated. From 50 to 20
Property 'proxy' was removed
Property 'follow' was removed
Property 'verbose' was added with value: true
```

### json:
```
[
{
"key": "group1",
"type": "nested",
"children": [
{
"key": "baz",
"type": "updated",
"oldValue": "bas",
"newValue": "bars"
},
{
"key": "foo",
"type": "unchanged",
"value": "bar"
},
{
"key": "nest",
"type": "updated",
"oldValue": {
"key": "value"
},
"newValue": "str"
}
]
},
{
"key": "group2",
"type": "removed",
"value": {
"abc": "12345"
}
}
]
```