Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SlimIO/json-diff
Stdout difference from two JS Objects in the TTY
https://github.com/SlimIO/json-diff
Last synced: 23 days ago
JSON representation
Stdout difference from two JS Objects in the TTY
- Host: GitHub
- URL: https://github.com/SlimIO/json-diff
- Owner: SlimIO
- License: mit
- Created: 2019-09-12T07:20:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T02:16:00.000Z (almost 2 years ago)
- Last Synced: 2024-11-08T14:17:29.424Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 382 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crafted-nodejs - @slimio/json-diff - Stdout difference from two JS Objects in the TTY (Packages / CLI (TTY etc..))
README
# Json-diff
![version](https://img.shields.io/badge/dynamic/json.svg?url=https://raw.githubusercontent.com/SlimIO/json-diff/master/package.json&query=$.version&label=Version)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/SlimIO/json-diff/commit-activity)
![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)
![size](https://img.shields.io/bundlephobia/min/@slimio/json-diff)
![dep](https://img.shields.io/david/SlimIO/json-diff)
![known vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/SlimIO/json-diff)
[![Build Status](https://travis-ci.com/SlimIO/json-diff.svg?branch=master)](https://travis-ci.com/SlimIO/json-diff)Differentiates JSON in you terminal with color.
## Requirements
- [Node.js](https://nodejs.org/en/) v12 or higher## Getting Started
This package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).
```bash
$ npm i @slimio/json-diff
# or
$ yarn add @slimio/json-diff
```## Usage example
```js
const jsonDiff = require("@slimio/json-diff");
const json1 = {
number: 10,
array: ["x", "y", "z"]
}const json2 = {
number: 20,
array: ["x", "y", "w"]
}jsonDiff(json1, json2);
```
It will produce the following stdout:![stdout](https://i.imgur.com/uVqCnqE.png)
## API
### jsonDiff(original: object, diff: object, options?: Options): void
Stdout the difference between two JSON Object. Available options is described by the following TypeScript interface
```ts
interface Options {
color?: boolean;
}
```## Dependencies
|Name|Refactoring|Security Risk|Usage|
|---|---|---|---|
|[kleur](https://github.com/lukeed/kleur)|Minor|Low|TTY color|## License
MIT