-
-
Save michaelficarra/742981 to your computer and use it in GitHub Desktop.
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
arrayEq = (a, b) -> | |
if a is b | |
# 0 isnt -0 | |
a isnt 0 or 1/a is 1/b | |
else if a instanceof Array and b instanceof Array | |
return no unless a.length is b.length | |
return no for el, idx in a when not arrayEq el, b[idx] | |
yes | |
else | |
# NaN is NaN | |
a isnt a and b isnt b | |
@arrayEqual = (a, b, msg) -> ok arrayEq(a,b), msg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment