Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is-shallow-equal: Documentation: Define shallow equality with inequality examples #7801

Closed
ntwb opened this issue Jul 9, 2018 · 1 comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Package] is-shallow-equal /packages/is-shallow-equal [Type] Developer Documentation Documentation for developers [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@ntwb
Copy link
Member

ntwb commented Jul 9, 2018

@aduth commented on Wed May 23 2018

Related Slack discussion: https://wordpress.slack.com/archives/C5UNMSU4R/p1526840808000021

@wordpress/is-shallow-equal includes the following text to describe its purpose:

A function for performing a shallow comparison between two objects or arrays. Two values have shallow equality when all of their members are strictly equal to the corresponding member of the other.

It's not entirely clear by this description the behavior that should be expected by the following example:

isShallowEqual( [ { id: 1 } ], [ { id: 1 } ] );

...except when the reader understands referential inequality of two newly-defined objects.

We should clarify in the documentation...

  • The difference between shallow equality and deep equality
  • An example where @wordpress/is-shallow-equal may return false where a deep isEqual would return true (as above)
    • And unit test?
@ntwb ntwb added [Type] Task Issues or PRs that have been broken down into an individual action to take [Type] Developer Documentation Documentation for developers Good First Issue An issue that's suitable for someone looking to contribute for the first time [Package] is-shallow-equal /packages/is-shallow-equal labels Jul 9, 2018
@ajitbohra ajitbohra added this to the Documentation & Handbook milestone Oct 4, 2018
@youknowriad youknowriad removed this from the Documentation & Handbook milestone Mar 18, 2019
@aduth
Copy link
Member

aduth commented Apr 9, 2019

Considering this to be resolved by #13526

@aduth aduth closed this as completed Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Package] is-shallow-equal /packages/is-shallow-equal [Type] Developer Documentation Documentation for developers [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

4 participants