-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
add snippet to compare two javascript arrays for equality #205
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this snippet is way too big
β¦ possible, switch to strict equality, use every instead of loop for one liner, add object tag
Sorry, made it 2.5x shorter while still comparing objects, etc. Is this better? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Okay, messed it up a little bit but it's fixed now. |
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