add snippet to compare two javascript arrays for equality#205
Merged
majvax merged 9 commits intoquicksnip-dev:mainfrom Jan 17, 2025
Merged
add snippet to compare two javascript arrays for equality#205majvax merged 9 commits intoquicksnip-dev:mainfrom
majvax merged 9 commits intoquicksnip-dev:mainfrom
Conversation
majvax
requested changes
Jan 6, 2025
Collaborator
majvax
left a comment
There was a problem hiding this comment.
Hey, thanks for your contribution! 🙌
I have a few changes I'm thinking about:
- Adding validation (e.g. Array.isArray)
- Adding support for deep equality,
compareArrays([[1,2]], [[1,2]]);returnfalse
compareArrays([{a:1}], [{a:1}]);returnfalse
It will make your snippets more versatile.
Mathys-Gasnier
requested changes
Jan 8, 2025
… possible, switch to strict equality, use every instead of loop for one liner, add object tag
Contributor
Author
|
Sorry, made it 2.5x shorter while still comparing objects, etc. Is this better? |
majvax
requested changes
Jan 9, 2025
Collaborator
majvax
left a comment
There was a problem hiding this comment.
For me it's good but I will ask two last little thing:
- what's your opinion on the change
- merging main branch onto your branch to get rid of
public/consolidated/*, we recently update our system to make PR easier and those files are no longer needed.
6d4d53a to
93ccb16
Compare
Contributor
Author
|
Okay, messed it up a little bit but it's fixed now. |
| @@ -0,0 +1,32 @@ | |||
| --- | |||
| title: Compare Arrays | |||
| description: Compares two arrays to check if they are equal. | |||
Collaborator
There was a problem hiding this comment.
I would like the description to tell that it compares deeply two arrays since we added that
Mathys-Gasnier
approved these changes
Jan 11, 2025
psychlone77
approved these changes
Jan 15, 2025
Collaborator
psychlone77
left a comment
There was a problem hiding this comment.
Tested and looks good 👍
majvax
approved these changes
Jan 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added a new JavaScript snippet that compares two arrays, checking for equality.
Type of Change
Checklist
Related Issues
Closes #
Additional Context
Screenshots (Optional)
Click to view screenshots