https://github.com/tiaanduplessis/compare-obj
Recursively compare 2 objects on a property bases to get the difference
https://github.com/tiaanduplessis/compare-obj
compare diff objects properties
Last synced: 6 months ago
JSON representation
Recursively compare 2 objects on a property bases to get the difference
- Host: GitHub
- URL: https://github.com/tiaanduplessis/compare-obj
- Owner: tiaanduplessis
- License: mit
- Created: 2017-05-01T11:29:12.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-07-20T09:40:24.000Z (over 6 years ago)
- Last Synced: 2025-07-02T18:03:56.179Z (7 months ago)
- Topics: compare, diff, objects, properties
- Language: JavaScript
- Size: 135 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# compare-obj
[](https://npmjs.org/package/compare-obj)
[](https://npmjs.org/package/compare-obj)
[](https://github.com/RichardLitt/standard-readme)
[](https://npmjs.org/package/compare-obj)
[](http://makeapullrequest.com)
> Recursively compare 2 objects on a property bases to get the difference
## Table of Contents
- [About](#about)
- [Features](#features)
- [Usage](#usage)
- [Install](#install)
- [Contribute](#contribute)
- [License](#License)
## About
Explain the problem the package is trying to solve.
## Features
- Name key features e.g. size, performance, how it differs from similar solutions etc.
## Usage
```js
const compare = require('compare-obj')
const data = {
id: 'foobarbaz',
name: 'Bazzy',
contactNumber: '0000000',
contactIds: ['one', 'two', 'three']
}
const initialValues = {
id: 'foobarbaz',
name: 'Bazzy',
contactIds: ['one', 'two']
}
console.log(compare(data, initialValues))
// { contactNumber: '0000000', contactIds: [ 'three' ] }
```
## Install
This project uses [node](https://nodejs.org) and [npm](https://www.npmjs.com).
```sh
$ npm install compare-obj
$ # OR
$ yarn add compare-obj
```
## Contribute
1. Fork it and create your feature branch: `git checkout -b my-new-feature`
2. Commit your changes: `git commit -am "Add some feature"`
3. Push to the branch: `git push origin my-new-feature`
4. Submit a pull request
## License
MIT