Skip to content

Instantly share code, notes, and snippets.

@colinmeinke
Created March 2, 2016 17:54
Show Gist options
  • Save colinmeinke/25aa2d3c5bd9708cfd69 to your computer and use it in GitHub Desktop.
Save colinmeinke/25aa2d3c5bd9708cfd69 to your computer and use it in GitHub Desktop.
simple recursive matching
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