Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lourd/js-equal-by-keys
Javascript utility function for comparing objects only for given keys
https://github.com/lourd/js-equal-by-keys
javascript object-equality react small-modules unix-philosophy utility
Last synced: 24 days ago
JSON representation
Javascript utility function for comparing objects only for given keys
- Host: GitHub
- URL: https://github.com/lourd/js-equal-by-keys
- Owner: lourd
- License: mit
- Created: 2018-01-27T23:05:05.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-28T00:35:38.000Z (almost 7 years ago)
- Last Synced: 2024-09-13T12:37:54.076Z (about 2 months ago)
- Topics: javascript, object-equality, react, small-modules, unix-philosophy, utility
- Language: JavaScript
- Size: 33.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# @lourd/equal-by-keys [![npm package badge][npm-badge]][npm] [![Build status][travis-badge]][travis]
[npm-badge]: https://img.shields.io/npm/v/@lourd/equal-by-keys.svg?style=flat-square
[npm]: https://www.npmjs.com/package/@lourd/equal-by-keys
[travis-badge]: https://travis-ci.org/lourd/js-equal-by-keys.svg
[travis]: https://travis-ci.org/lourd/js-equal-by-keysThis single-function JavaScript module is a utility for comparing two objects for a given set of keys. I find it handy when looking for changing props in React component lifecycle methods like [`componentDidUpdate`](https://reactjs.org/docs/react-component.html#componentdidupdate).
## Installation
### npm
```sh
yarn install @lourd/equal-by-keys
```### In the browser
[Available as a simple `` through unpkg.com](https://unpkg.com/@lourd/[email protected]/umd/@lourd/equal-by-keys.js). The function will be available as the global variable `equalByKeys`.
## API
### `equalByKeys(objA: Object, objB: Object, ...keys: [String])`