1.1.0 • Published 6 years ago

shallowequal v1.1.0

Weekly downloads
4,913,063
License
MIT
Repository
github
Last release
6 years ago

shallowequal Build Status Downloads npm version

Greenkeeper badge

shallowequal is like lodash's isEqualWith but for shallow (strict) equal.

shallowequal(value, other, [customizer], [thisArg])

Performs a shallow equality comparison between two values (i.e. value and 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 value and other. Otherwise, return true whenever the values of all keys are strictly equal.

If customizer (expected to be a function) is provided it is invoked to compare values. If customizer returns undefined (i.e. void 0), then comparisons are handled by the shallowequal function instead.

The customizer is bound to thisArg and invoked with three arguments: (value, other, key).

NOTE: Docs are (shamelessly) adapted from lodash's v3.x docs

Install

$ yarn add shallowequal
# npm v5+
$ npm install shallowequal
# before npm v5
$ npm install --save shallowequal

Usage

const shallowequal = require('shallowequal');

const object = { 'user': 'fred' };
const other = { 'user': 'fred' };

object == other;
// → false

shallowequal(object, other);
// → true

Credit

Code for 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 v4.17.4).

Development

Chores

  • Lint: yarn lint
  • Test: yarn test
  • Pretty: yarn pretty
  • Pre-publish: yarn prepublish

License

MIT.

styled-componentsreact-helmet-asyncreact-sizemereact-hot-loaderff-antd-vue@flyteorg/console@flyteoss/console@revolut/ui-kiteasy-select-rn@firesoon/antd-tabledcxt-design-xue-xant-mstant-master@bushuai/uni-testyzhantd@miot-plugin/rc-slider@ericpuskas/react-to-npm@hi-ui/hiui2view-app-uireact-helmet-ie8react-native-pkrs-gifted-chatrand-react-helmet-asyncrulework-react-data-gridantd-zpg2_v587_gv587_adminjdc-rc-commontest-rc-commonmikedemarais-styled-componentsoneview-guireact-tableau-viewtmaito-processgoldmine-serverss-ui-libreact-treebeard-fromrepoxhn-design-vuezyd-design-vueant-design-vue-xuexueant-design-vue-xxxue-dev-new-xant-design-vue-xxxxue-dev-new2@rnna/routergrowth-antd-webant-design-vue-lapinsync-stageplayervue-ant-patterns-cicdybbtestui1mio-design-vuejw-react-naver-mapsa-tree-selectreact-web-gifted-scroll-chatpromebeeuij-beeui@paraponera/antdaddnewer-uiantdsant-design-vue-ysb@pagezilla/utilsxc-mobilexcmobilesumo-schema-editor@askme-inc/ant-design-vue@denkristoffer/react-headroomsid-npm-test3sid-npmtest-1sid-npmtest-2sid-test-create-npm@lightningui/react@blinkz/react-hot-loadergrossjsgreat-editormobx-react-form-fieldstest-ant-design-vueblockit-selectionblockit-storeblockit-texteditorrun-design-vue2@infinitebrahmanuniverse/nolb-shalcfbgc-componentsmk-util-libraryccyy-rc-util@noahbaron91/utilsantd-without-babeltest-schh-uimaycur-antdluck-design-testx-intelligent-uiwix-style-reactwix-ui-coregatsby-theme-fencing@everything-registry/sub-chunk-2745snbc-paas-ui@explodingcamera/react-hot-loaderant-design-vue-zxkjcpaas-uirc-slider-with-dots@bountie/semantic-ui-react@deli/redux-form
1.1.0

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago