{"size": 934, "ext": "js", "max_stars_repo_path": "src/parser/spells/name.js", "max_stars_repo_name": "Daggersoath/ddb-importer", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/parser/spells/name.js", "max_issues_repo_name": "Daggersoath/ddb-importer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/parser/spells/name.js", "max_forks_repo_name": "Daggersoath/ddb-importer", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.1333333333, "max_line_length": 124, "alphanum_fraction": 0.7152034261}
function getCustomName(data, character) {
  if (!hasProperty(character, "flags.ddbimporter.dndbeyond.characterValues")) return null;
  const characterValues = character.flags.ddbimporter.dndbeyond.characterValues;
  const customValue = characterValues.filter((value) => value.valueId == data.id && value.valueTypeId == data.entityTypeId);

  if (customValue) {
    const customName = customValue.find((value) => value.typeId == 8);

    if (customName) {
      data.name = customName.vale;
      return customName.value;
    }
    if (customName) return customName.value;
  }
  return null;
}


export function getName(data, character) {
  // spell name
  const customName = getCustomName(data, character);
  if (customName) {
    return customName;
  } else if (data.flags.ddbimporter.dndbeyond.nameOverride !== undefined) {
    return data.flags.ddbimporter.dndbeyond.nameOverride;
  } else {
    return data.definition.name;
  }
}
