{"size": 583, "ext": "js", "max_stars_repo_path": "src/syllableCount.js", "max_stars_repo_name": "islenska-org/icelandic", "max_stars_repo_stars_event_min_datetime": "2016-11-05T18:26:30.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-30T16:05:40.000Z", "max_issues_repo_path": "src/syllableCount.js", "max_issues_repo_name": "islenska-org/icelandic", "max_issues_repo_issues_event_min_datetime": "2017-09-28T18:32:25.000Z", "max_issues_repo_issues_event_max_datetime": "2017-09-28T18:32:25.000Z", "max_forks_repo_path": "src/syllableCount.js", "max_forks_repo_name": "islenska-org/icelandic", "max_forks_repo_forks_event_min_datetime": "2017-01-13T10:49:59.000Z", "max_forks_repo_forks_event_max_datetime": "2017-01-13T10:49:59.000Z"}
{"max_stars_count": 9, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 29.15, "max_line_length": 70, "alphanum_fraction": 0.3001715266}
// return the number of syllables in an Icelandic word
module.exports = function (word) {
  let s = 0;
  for (let i = 0; i < word.length; i++) {
    const c = word[i];
    if ((c === 'a' && word[i + 1] === 'u') ||
        (c === 'e' && (word[i + 1] === 'i' || word[i + 1] === 'y'))) {
      i++;
      s++;
    }
    else if (c === 'a' || c === 'á' || c === 'e' || c === 'é' ||
             c === 'i' || c === 'í' || c === 'o' || c === 'ó' ||
             c === 'u' || c === 'ú' || c === 'y' || c === 'ý' ||
             c === 'æ' || c === 'ö') {
      s++;
    }
  }
  return s;
};
