# differently

> Compare JS Objects With Color Difference.

Latest version **1.0.1** (published 2019-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install differently
pnpm add differently
yarn add differently
bun add differently
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-04-29 |
| First published | 2019-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 13.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Anton |
| Maintainers | zvr |
| Keywords | differently, diff, difference, object, js, javascript |

## Links

- npm: https://www.npmjs.com/package/differently
- Repository: https://github.com/contexttesting/differently
- Homepage: https://github.com/contexttesting/differently#readme
- Issues: https://github.com/contexttesting/differently/issues
- npm.io page: https://npm.io/package/differently

## Dependencies (1)

- [erte](https://npm.io/package/erte.md) ^1.2.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.1 (latest) — 2019-04-29
- 1.0.0 — 2019-04-29

## README

# differently

[![npm version](https://badge.fury.io/js/differently.svg)](https://npmjs.org/package/differently)

`differently` Compares JS Objects With Color Difference.

```sh
yarn add differently
```

## Table Of Contents

- [Table Of Contents](#table-of-contents)
- [API](#api)
- [`differently(objectA: *, objectB: *): string`](#differentlyobjecta-objectb--string)
- [Copyright](#copyright)

<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/0.svg?sanitize=true"></a></p>

## API

The package is available by importing its default function:

```js
import differently from 'differently'
```

<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/1.svg?sanitize=true"></a></p>

## `differently(`<br/>&nbsp;&nbsp;`objectA: *,`<br/>&nbsp;&nbsp;`objectB: *,`<br/>`): string`

Compares the two given objects recursively. Returns the string containing the highlighted difference between the compared values. This is meant to work with `deepEqual`, where the order of elements in the array matters.

```js
import differently from 'differently'

s = differently(null, {})
log(s)

s = differently({}, null)
log(s)

s = differently(new Date(2018, 10), new Date(2017, 10))
log(s)

s = differently(new Date(2018, 10), [])
log(s)

s = differently(['test'], {})
log(s)

s = differently(10, '11')
log(s)

s = differently(Symbol('test'), false)
log(s)

s = differently(Symbol('test'), new Date(2019, 10))
log(s)

s = differently({ a: 0, test: 1, common: {
  tt: 10,
  ta: [1, 3],
} }, { a: 0, testa: 2, common: {
  tt: 20,
  ta: [1, 2],
} })
log(s)

log(differently([1], [2, Infinity]))
```

<table>
<tr><th>Output</th><th>CLI</th></tr>
<tr><td>

```
- null
+ [object Object]

- [object Object]
+ null

- Thu Nov 01 2018 00:00:00 GMT+0300 (MSK)
+ Wed Nov 01 2017 00:00:00 GMT+0300 (MSK)

- Thu Nov 01 2018 00:00:00 GMT+0300 (MSK)
+ Array[]

- Array[test]
+ [object Object]

- 10
+ 11

- Symbol(test)
+ false

- Symbol(test)
+ Fri Nov 01 2019 00:00:00 GMT+0300 (MSK)

- test: 1
+ testa: 2
  common
    tt
    - 10
    + 20
    ta.Array
    [1]
    - 3
    + 2

[0]
- 1
+ 2
[1]
+ Infinity
```
</td><td>

![Showing the color differently](doc/doc.png)
</td></tr>
</table>

<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/2.svg?sanitize=true"></a></p>

## Copyright


  (c) [Context Testing](https://contexttesting.com) 2019


<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/-1.svg?sanitize=true"></a></p>

---
_Source: https://npm.io/package/differently · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
