Skip to content

Instantly share code, notes, and snippets.

@kapusta
Created March 12, 2018 13:47
Show Gist options
  • Save kapusta/fee9692766776a25790d74fbd1c7ad5c to your computer and use it in GitHub Desktop.
Save kapusta/fee9692766776a25790d74fbd1c7ad5c to your computer and use it in GitHub Desktop.
compare two objects without recursion
(function() {
var obj1 = {
foo: 'qwerty',
bar: 'asdfgh',
};
var obj2 = {
foo: '123456',
bar: '098765',
};
var compare = function(a, b) {
return window.btoa(JSON.stringify(a)) === window.btoa(JSON.stringify(b));
};
}());
@kapusta
Copy link
Author

kapusta commented Mar 12, 2018

Bad idea, doesn't work with same props in diff order. Rectify unidea this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment