js/match/operator.js
/**
 * Note: both arguments are expected to be lowercased
 */
both arguments are expected to be lowercased
both arguments are expected to be lowercased
function matches(operator, fragmentLC, strLC) {
    if (!strLC) {
        return false;
    }
    switch (operator.operator) {
        case "starting with":
            return strLC.indexOf(fragmentLC) === 0;
        case "containing":
            return strLC.indexOf(fragmentLC) >= 0;
        case "ending with":
            return strLC.length >= fragmentLC.length &&
                strLC.substring(strLC.length - fragmentLC.length) === fragmentLC;
        default:
            throw new Error('Unknown operator or illegal operator usage: ' + operator.operator);
    }
}
function matches ( operator , fragmentLC , strLC ) { if ( ! strLC ) { return false ; } switch ( operator . operator ) { case "starting with" : return strLC . indexOf ( fragmentLC ) === 0 ; case "containing" : return strLC . indexOf ( fragmentLC ) >= 0 ; case "ending with" : return strLC . length >= fragmentLC . length && strLC . substring ( strLC . length - fragmentLC . length ) === fragmentLC ; default : throw new Error ( 'Unknown operator or illegal operator usage: ' + operator . operator ) ; } }
Note: both arguments are expected to be lowercased
Note : both arguments are expected to be lowercased
//return false;