/**
 * 判断两个对象是否相等
 **/
export const isObjEqual = function (obj1: any, obj2: any) {
  const keys1 = Object.keys(obj1);
  const keys2 = Object.keys(obj2);

  if (keys1.length === keys2.length) {
    const sortKeys1 = keys1.sort();
    const sortKeys2 = keys2.sort();

    const sortStr1 = JSON.stringify(sortKeys1);
    const sortStr2 = JSON.stringify(sortKeys2);

    if (sortStr1 === sortStr2) {
      let flag = true;
      for (const key1 in obj1) {
        if (obj1[key1] !== obj2[key1]) {
          flag = false;
          break;
        }
      }
      return flag;
    } else {
      return false;
    }
  } else {
    return false;
  }
};
