@ngdoc function
@name name.types:constructor.Name#setNamePart
@methodOf name.types:constructor.Name

@description sets the changed flag as well as the value;
you can call setGivenName, setSurname, setPrefix, and setSuffix instead of this function
@param {String} name value
@param {String} type http://gedcomx.org/Given or http://gedcomx.org/Surname
@param {Number=} i name form to set; defaults to 0
@return {Name} this name
function(name, type, i) {
    this.changed = true;
    var nameForm = ensureNameForm(this, i);
    if (!utils.isArray(nameForm.parts)) {
      nameForm.parts = [];
    }
    var part = utils.find(nameForm.parts, {type: type});
    if (!!name) {
      if (!part) {
        part = {type: type};
        nameForm.parts.push(part);
      }
      part.value = name;
    }
    else if (!!part) {
      nameForm.parts.splice(nameForm.parts.indexOf(part), 1);
    }
    //noinspection JSValidateTypes
    return this;
  }