lourd / js-equal-by-keys

Javascript utility function for comparing objects only for given keys

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@lourd/equal-by-keys npm package badge Build status

This 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.

Installation

npm

yarn install @lourd/equal-by-keys

In the browser

Available as a simple <script> through unpkg.com. The function will be available as the global variable equalByKeys.

API

equalByKeys(objA: Object, objB: Object, ...keys: [String])

About

Javascript utility function for comparing objects only for given keys

License:MIT License


Languages

Language:JavaScript 100.0%