dist/CommentCoreLibrary.js
function _match (rule, cmtData) {
        var path = rule.subject.split('.');
        var extracted = cmtData;
        while (path.length > 0) {
            var item = path.shift();
            if (item === '') {
                continue;
            }
            if (extracted.hasOwnProperty(item)) {
                extracted = extracted[item];
            }
            if (extracted === null || typeof extracted === 'undefined') {
                extracted = null;
                break;
            }
        }
        if (extracted === null) {
            // Null precondition implies anything
            return true;
        }
        switch (rule.op) {
            case '<':
                return extracted < rule.value;
            case '>':
                return extracted > rule.value;
            case '~':
            case 'regexp':
                return (new RegExp(rule.value)).test(extracted.toString());
            case '=':
            case 'eq':
                return rule.value ===
                    ((typeof extracted === 'number') ?
                        extracted : extracted.toString());
            case '!':
            case 'not':
                return !_match(rule.value, extracted);
            case '&&':
            case 'and':
                if (Array.isArray(rule.value)) {
                    return rule.value.every(function (r) {
                        return _match(r, extracted);
                    });
                } else {
                    return false;
                }
            case '||':
            case 'or':
                if (Array.isArray(rule.value)) {
                    return rule.value.some(function (r) {
                        return _match(r, extracted);
                    });
                } else {
                    return false;
                }
            default:
                return false;
        }
    }
function _match (rule, cmtData) {
        var path = rule.subject.split('.');
        var extracted = cmtData;
        while (path.length > 0) {
            var item = path.shift();
            if (item === '') {
                continue;
            }
            if (extracted.hasOwnProperty(item)) {
                extracted = extracted[item];
            }
            if (extracted === null || typeof extracted === 'undefined') {
                extracted = null;
                break;
            }
        }
        if (extracted === null) {
            // Null precondition implies anything
            return true;
        }
        switch (rule.op) {
            case '<':
                return extracted < rule.value;
            case '>':
                return extracted > rule.value;
            case '~':
            case 'regexp':
                return (new RegExp(rule.value)).test(extracted.toString());
            case '=':
            case 'eq':
                return rule.value ===
                    ((typeof extracted === 'number') ?
                        extracted : extracted.toString());
            case '!':
            case 'not':
                return !_match(rule.value, extracted);
            case '&&':
            case 'and':
                if (Array.isArray(rule.value)) {
                    return rule.value.every(function (r) {
                        return _match(r, extracted);
                    });
                } else {
                    return false;
                }
            case '||':
            case 'or':
                if (Array.isArray(rule.value)) {
                    return rule.value.some(function (r) {
                        return _match(r, extracted);
                    });
                } else {
                    return false;
                }
            default:
                return false;
        }
    }
function _match ( rule , cmtData ) { var path = rule . subject . split ( '.' ) ; var extracted = cmtData ; while ( path . length > 0 ) { var item = path . shift ( ) ; if ( item === '' ) { continue ; } if ( extracted . hasOwnProperty ( item ) ) { extracted = extracted [ item ] ; } if ( extracted === null || typeof extracted === 'undefined' ) { extracted = null ; break ; } } if ( extracted === null ) { // Null precondition implies anything return true ; } switch ( rule . op ) { case '<' : return extracted < rule . value ; case '>' : return extracted > rule . value ; case '~' : case 'regexp' : return ( new RegExp ( rule . value ) ) . test ( extracted . toString ( ) ) ; case '=' : case 'eq' : return rule . value === ( ( typeof extracted === 'number' ) ? extracted : extracted . toString ( ) ) ; case '!' : case 'not' : return ! _match ( rule . value , extracted ) ; case '&&' : case 'and' : if ( Array . isArray ( rule . value ) ) { return rule . value . every ( function ( r ) { return _match ( r , extracted ) ; } ) ; } else { return false ; } case '||' : case 'or' : if ( Array . isArray ( rule . value ) ) { return rule . value . some ( function ( r ) { return _match ( r , extracted ) ; } ) ; } else { return false ; } default : return false ; } }
Matches a rule against an input that could be the full or a subset of
the comment data.

@param rule - rule object to match
@param cmtData - full or portion of comment data
@return boolean indicator of match
Matches a rule against an input that could be the full or a subset of the comment data .