shallowequalis like lodash's
isEqualWithbut for shallow (strict) equal.
shallowequal(value, other, [customizer], [thisArg])
Performs a shallow equality comparison between two values (i.e.
other) to determine if they are equivalent.
The equality is performed by iterating through keys on the given
value, and returning
false whenever any key has values which are not strictly equal between
other. Otherwise, return
true whenever the values of all keys are strictly equal.
customizer (expected to be a function) is provided it is invoked to compare values. If
void 0), then comparisons are handled by the
shallowequal function instead.
customizer is bound to
thisArg and invoked with three arguments:
(value, other, key).
NOTE: Docs are (shamelessly) adapted from lodash's v3.x docs
$ yarn add shallowequal# npm v5+$ npm install shallowequal# before npm v5$ npm install --save shallowequal
const shallowequal = ;const object = 'user': 'fred' ;const other = 'user': 'fred' ;object == other;// → false;// → true
shallowEqual originated from https://github.com/gaearon/react-pure-render/ and has since been refactored to have the exact same API as
lodash.isEqualWith (as of
npm. See: https://github.com/creationix/nvm#installation
yarn. See: https://yarnpkg.com/en/docs/install