SHARE
TWEET

Untitled

a guest Mar 20th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function isObjectEqual(a, b) {
  2.  let aProps = Object.getOwnPropertyNames(a),
  3.      bProps = Object.getOwnPropertyNames(b);
  4.  
  5.   if (aProps.length !== bProps.length) {
  6.     return false;
  7.   }
  8.  
  9.   for (let i = 0; i < aProps.length; i++) {
  10.    let propName = aProps[i];
  11.     if(a[propName] !== b[propName]) {
  12.       return false;
  13.     }
  14.   }
  15.  
  16.   return true;
  17. }
RAW Paste Data
Top