function checkGiftLists(updatedUserData){
    var newGiftList = updatedUserData.giftList;
    var newPrivateGiftList = updatedUserData.privateList;

    if(newGiftList == undefined){}
    else if(newGiftList != undefined) {
      for (var i = 0; i < userBoughtGiftsArr.length; i++) {
        var a = findUIDItemInArr(userBoughtGiftsArr[i].uid, newGiftList);
        if (a != -1) {
          //console.log(newGiftList[a]);
          checkGiftData(userBoughtGiftsArr[i], newGiftList[a], updatedUserData.name);
        }
      }
    }

    if(newPrivateGiftList == undefined){}
    else if(newPrivateGiftList.length != undefined) {
      for (var i = 0; i < userBoughtGiftsArr.length; i++) {
        var a = findUIDItemInArr(userBoughtGiftsArr[i], newPrivateGiftList);
        if (a != -1) {
          //console.log(newPrivateGiftList[a]);
          checkGiftData(userBoughtGiftsArr[i], newPrivateGiftList[a], updatedUserData.name);
        }
      }
    }
  }
//This function compares new gift lists and new private gift lists to the old gift lists and old private gift lists.
This function compares new gift lists and new private gift lists to the old gift lists and old private gift lists.
This function compares new gift lists and new private gift lists to the old gift lists and old private gift lists .
function checkGiftLists(updatedUserData){
    var newGiftList = updatedUserData.giftList;
    var newPrivateGiftList = updatedUserData.privateList;
    if(newGiftList == undefined){}
    else if(newGiftList != undefined) {
      for (var i = 0; i < userBoughtGiftsArr.length; i++) {
        var a = findUIDItemInArr(userBoughtGiftsArr[i].uid, newGiftList);
        if (a != -1) {
          checkGiftData(userBoughtGiftsArr[i], newGiftList[a], updatedUserData.name);
        }
      }
    }
    if(newPrivateGiftList == undefined){}
    else if(newPrivateGiftList.length != undefined) {
      for (var i = 0; i < userBoughtGiftsArr.length; i++) {
        var a = findUIDItemInArr(userBoughtGiftsArr[i], newPrivateGiftList);
        if (a != -1) {
          checkGiftData(userBoughtGiftsArr[i], newPrivateGiftList[a], updatedUserData.name);
        }
      }
    }
  }
function checkGiftLists ( updatedUserData ) { var newGiftList = updatedUserData . giftList ; var newPrivateGiftList = updatedUserData . privateList ; if ( newGiftList == undefined ) { } else if ( newGiftList != undefined ) { for ( var i = 0 ; i < userBoughtGiftsArr . length ; i ++ ) { var a = findUIDItemInArr ( userBoughtGiftsArr [ i ] . uid , newGiftList ) ; if ( a != - 1 ) { checkGiftData ( userBoughtGiftsArr [ i ] , newGiftList [ a ] , updatedUserData . name ) ; } } } if ( newPrivateGiftList == undefined ) { } else if ( newPrivateGiftList . length != undefined ) { for ( var i = 0 ; i < userBoughtGiftsArr . length ; i ++ ) { var a = findUIDItemInArr ( userBoughtGiftsArr [ i ] , newPrivateGiftList ) ; if ( a != - 1 ) { checkGiftData ( userBoughtGiftsArr [ i ] , newPrivateGiftList [ a ] , updatedUserData . name ) ; } } } }
This function compares new gift lists and new private gift lists to the old gift lists and old private gift lists.
This function compares new gift lists and new private gift lists to the old gift lists and old private gift lists .
//console.log(newGiftList[a]); //console.log(newPrivateGiftList[a]);