Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

shallowequal

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Issues
File Explorer

Advanced tools

shallowequal

Like lodash isEqualWith but for shallow equal.

    1.1.0latest

Version published
Maintainers
1
Weekly downloads
7,090,897
decreased by-13.7%

Weekly downloads

Changelog

Source

v1.1.0

  • Added flow types.

Readme

Source

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.

Keywords

FAQs

What is shallowequal?

Like lodash isEqualWith but for shallow equal.

Is shallowequal popular?

The npm package shallowequal receives a total of 5,723,741 weekly downloads. As such, shallowequal popularity was classified as popular.

Is shallowequal well maintained?

We found that shallowequal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 23 Jun 2018

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc