Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in isVowel() in double_metaphone.js #34

Closed
thomasfr opened this issue Apr 18, 2012 · 1 comment
Closed

Error in isVowel() in double_metaphone.js #34

thomasfr opened this issue Apr 18, 2012 · 1 comment

Comments

@thomasfr
Copy link

Hi, i came across an error in isVowel(c) where c was undefined and so c.match throwed an error:

function isVowel(c) {
    if(!c) return false; // i added this as a workaround
    return c.match(/[aeiouy]/i);
}

This happened when isVowel gets called from handleH on line 223. I think the problem is that token[pos+1] is undefined.

    function handleH() {
        // keep if starts a word or is surrounded by vowels
        if((pos == 0 || isVowel(token[pos - 1])) && isVowel(token[pos + 1])) {
            add('H');
            pos++;
        }
    }
@chrisumbel
Copy link
Member

ah, thanks. i'll address this shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants