js/ka-validator.js
/**
     * Performs validation of the given javascript code checking that all the
     * node types specified in nodeTypes are not present. For any node types
     * present in the javascript code, an alert object will be created and added to
     * a list of alerts. The alert object will consist of a boolean disallowed=true
     * field and a string type field. If the javascript cannot be parsed, a single
     * alert with the parser error message will be returned.
     *
     * @param {string} script - The javascript code string
     * @param {(string|string[])} nodeTypes - The node type or types that must exist in the code
     * @returns {Array} Array of all alert objects generated by the validation.
     */
Performs validation of the given javascript code checking that all the
node types specified in nodeTypes are not present. For any node types
present in the javascript code, an alert object will be created and added to
a list of alerts. The alert object will consist of a boolean disallowed=true
field and a string type field. If the javascript cannot be parsed, a single
alert with the parser error message will be returned.

@param {string} script - The javascript code string
@param {(string|string[])} nodeTypes - The node type or types that must exist in the code
@returns {Array} Array of all alert objects generated by the validation.
Performs validation of the given javascript code checking that all the node types specified in nodeTypes are not present . For any node types present in the javascript code an alert object will be created and added to a list of alerts . The alert object will consist of a boolean disallowed = true field and a string type field . If the javascript cannot be parsed a single alert with the parser error message will be returned . @param { string } script - The javascript code string @param { ( string|string [] ) } nodeTypes - The node type or types that must exist in the code @returns { Array } Array of all alert objects generated by the validation .
function evaluateDisallowed(script, nodeTypes) {
        var i,
            ast,
            alerts = [];
        ast = parseCode(script, alerts);
        if (ast && nodeTypes) {
            if (Array.isArray(nodeTypes)) {
                for (i = 0; i < nodeTypes.length; i++) {
                    if (hasNodeType(ast, nodeTypes[i])) {
                        alerts.push({
                            type: alertTypes.DISALLOWED,
                            nodeType: nodeTypes[i]
                        });
                    }
                }
            } else {
                if (hasNodeType(ast, nodeTypes)) {
                    alerts.push({
                        type: alertTypes.DISALLOWED,
                        nodeType: nodeTypes
                    });
                }
            }
        }
        return alerts;
    }
function evaluateDisallowed ( script , nodeTypes ) { var i , ast , alerts = [ ] ; ast = parseCode ( script , alerts ) ; if ( ast && nodeTypes ) { if ( Array . isArray ( nodeTypes ) ) { for ( i = 0 ; i < nodeTypes . length ; i ++ ) { if ( hasNodeType ( ast , nodeTypes [ i ] ) ) { alerts . push ( { type : alertTypes . DISALLOWED , nodeType : nodeTypes [ i ] } ) ; } } } else { if ( hasNodeType ( ast , nodeTypes ) ) { alerts . push ( { type : alertTypes . DISALLOWED , nodeType : nodeTypes } ) ; } } } return alerts ; }
Performs validation of the given javascript code checking that all the
 node types specified in nodeTypes are not present.
Performs validation of the given javascript code checking that all the node types specified in nodeTypes are not present .