3.1.0 • Published 1 year ago

shallow-equal v3.1.0

Weekly downloads
2,288,039
License
MIT
Repository
github
Last release
1 year ago

Description

If you know you have two arrays or two objects in hand, and you want to know if they are shallowly equal or not, this library is for you.

Features

  • Super light
  • No dependencies
  • Thoroughly tested

Installation

npm install shallow-equal --save

or

yarn add shallow-equal

Usage

import { shallowEqualArrays } from "shallow-equal";

shallowEqualArrays([1, 2, 3], [1, 2, 3]); // => true
shallowEqualArrays([{ a: 5 }], [{ a: 5 }]); // => false
import { shallowEqualObjects } from "shallow-equal";

shallowEqualObjects({ a: 5, b: "abc" }, { a: 5, b: "abc" }); // => true
shallowEqualObjects({ a: 5, b: {} }, { a: 5, b: {} }); // => false

You can also use the generic form, shallowEqual. But note that it does runtime type checking in order to decide whether it's comparing arrays or objects, so the convenience comes with a runtime penalty.

import { shallowEqual } from "shallow-equal";

shallowEqual([1, 2, 3], [1, 2, 3]); // => true
shallowEqual({ a: 5, b: {} }, { a: 5, b: {} }); // => false
ff-antd-vuebeer-ant-design-vuedcxt-design-xue-xant-mstant-master@fela-next/fela-bindingsreact17-swipeable-views-utilsxhn-design-vuezyd-design-vueant-design-vue-xuexueant-design-vue-xxxue-dev-new-xant-design-vue-xxxxue-dev-new2react-image-annotate-filterablegrowth-antd-webreact-date-range-testant-design-vue-lapvue-ant-patterns-cicdmio-design-vuemtd-reactni-design-vuemio-test-design-vueant-design-vue-ysbantv-xxx@askme-inc/ant-design-vuetest-ant-design-vuerun-design-vue2yty-dev-uixx-ant-design-vue@talkwed/andv@infinitebrahmanuniverse/nolb-shalcfbgc-componentsrc-cascader-customtest-schh-uireact-swipeable-view-utilsx-intelligent-ui@everything-registry/sub-chunk-2745snbc-paas-ui@schekhovtsov/react-date-rangeant-design-vue-zxkjcpaas-uizjstestpack-ant-v3-vuevue-antd-uivue-antd-ui-testvue-ant-patternszyl-ts-uizubtesttodayyr-xx-ant-design-vueyqcloud-uiyzs-antdvwj-ant-design-vuewetrade-designwang-dcxt-devwang-dcxtyazuo3yazuo4yiguo-designybdbc-designyonhis-uiui-vue-antdui-vue-antd-testu-libraryx-antd-vuex-antdv2xx-design-vuextf_advxue-devxue-dev-newxue1-devxft-design-vuexxxxxx-uiys-ant-design-vue-v2ys-iot-ant-design-vueyqt-antd-vueyss-image-annotateuse-item-sizevue-pro-elementvue-ui-packageup-react-date-range@googleforcreators/react@gromy/react-swipeable-views-utils@greenpeace/planet4-postcss-css-variablesfilemanager-library@mapbox/react-form@mapbox/mr-uitiqi-ta404-uitj-vctj-shardtq-ta404-uitq-ts-uisocialpilot-react-date-rangesoteria-uitheflash-ant-design-vuetanshubitest-ant-vue@imean/storagetest-roopher-1test-roopher-2test-roopher-3
3.1.0

1 year ago

3.0.0

1 year ago

1.2.1

4 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

8 years ago