lib/mlMutators.js
function addSourceInfoToML(memberLog, source) {

  let cloned = memberLog.slice();

  for (const [key, value] of getIterableObjectEntries(source)) {

    if (Talent.typeCheck(value)) {

      cloned = addSourceInfoToML(cloned, value);
    }

    const foundAndCloned = clone(findWhereKey(cloned, key));

    if (!foundAndCloned && !Talent.typeCheck(value)) {

      cloned.push({[key]: [value]});
    } else if (!Talent.typeCheck(value)) {

      foundAndCloned[key].push(value);
    }
  }

  return cloned;
}
function addSourceInfoToML(memberLog, source) {

  let cloned = memberLog.slice();

  for (const [key, value] of getIterableObjectEntries(source)) {

    if (Talent.typeCheck(value)) {

      cloned = addSourceInfoToML(cloned, value);
    }

    const foundAndCloned = clone(findWhereKey(cloned, key));

    if (!foundAndCloned && !Talent.typeCheck(value)) {

      cloned.push({[key]: [value]});
    } else if (!Talent.typeCheck(value)) {

      foundAndCloned[key].push(value);
    }
  }

  return cloned;
}
function addSourceInfoToML ( memberLog , source ) { let cloned = memberLog . slice ( ) ; for ( const [ key , value ] of getIterableObjectEntries ( source ) ) { if ( Talent . typeCheck ( value ) ) { cloned = addSourceInfoToML ( cloned , value ) ; } const foundAndCloned = clone ( findWhereKey ( cloned , key ) ) ; if ( ! foundAndCloned && ! Talent . typeCheck ( value ) ) { cloned . push ( { [ key ] : [ value ] } ) ; } else if ( ! Talent . typeCheck ( value ) ) { foundAndCloned [ key ] . push ( value ) ; } } return cloned ; }
Adds new entry to the member log or modifies an existing one
@param {Array.<Object>} memberLog The array of the members. The entries are objects with one own key
@param {Talent} source The talent which info needs to be added. (Might be nested)
@returns {Array.<Object>} The modified member log
Adds new entry to the member log or modifies an existing one