index.js
function isSandhanganWyanjana(position, input) {
    var chr = input.charAt(position),
        length = input.length,
        prevChr = input.charAt(position - 1),
        nextChr;

    // pacar = false
    if (position == length - 1) {
        return false;
    }

    // paras = false
    if (isSwara(prevChr)) {
        return false;
    }

    // pra = true
    // prahara = true
    if (chr == 'r') {
        nextChr = input.charAt(position + 1);
        if (nextChr == 'a' || nextChr == 'e') {
            return true;
        }

        return false;
    } else if (chr == 'y') {
        if (input.charAt(position + 1) == 'a') {
            return true;
        }

        return false;   
    }

    return false;
}
function isSandhanganWyanjana(position, input) {
    var chr = input.charAt(position),
        length = input.length,
        prevChr = input.charAt(position - 1),
        nextChr;

    // pacar = false
    if (position == length - 1) {
        return false;
    }

    // paras = false
    if (isSwara(prevChr)) {
        return false;
    }

    // pra = true
    // prahara = true
    if (chr == 'r') {
        nextChr = input.charAt(position + 1);
        if (nextChr == 'a' || nextChr == 'e') {
            return true;
        }

        return false;
    } else if (chr == 'y') {
        if (input.charAt(position + 1) == 'a') {
            return true;
        }

        return false;   
    }

    return false;
}
function isSandhanganWyanjana ( position , input ) { var chr = input . charAt ( position ) , length = input . length , prevChr = input . charAt ( position - 1 ) , nextChr ; // pacar = false if ( position == length - 1 ) { return false ; } // paras = false if ( isSwara ( prevChr ) ) { return false ; } // pra = true // prahara = true if ( chr == 'r' ) { nextChr = input . charAt ( position + 1 ) ; if ( nextChr == 'a' || nextChr == 'e' ) { return true ; } return false ; } else if ( chr == 'y' ) { if ( input . charAt ( position + 1 ) == 'a' ) { return true ; } return false ; } return false ; }
Mendeteksi sisipan ra, re, ya
@param  {Number}  position Posisi dari karakter yang hendak diperiksa
@param  {String}  input    Kalimat yang hendak diperiksa
@return {Boolean}
Mendeteksi sisipan ra re ya