Created
March 2, 2016 17:54
-
-
Save colinmeinke/25aa2d3c5bd9708cfd69 to your computer and use it in GitHub Desktop.
simple recursive matching
This file contains 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
const equals = ( a, b ) => { | |
if ( typeof a === 'object' && typeof b === 'object' && a !== null && b !== null ) { | |
for ( let k of Object.keys( a )) { | |
if ( !equals( a[ k ], b[ k ])) { | |
return false; | |
} | |
} | |
return true; | |
} | |
return a === b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment