js/ka-validator.js
/**
     * Performs validation of the given javascript code checking that all the
     * node types specified in nodeTypes are present. For any node types not
     * 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 required=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 present. For any node types not
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 required=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 present . For any node types not 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 required = 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 evaluateRequired(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.REQUIRED,
                            nodeType: nodeTypes[i]
                        });
                    }
                }
            } else {
                if (!hasNodeType(ast, nodeTypes)) {
                    alerts.push({
                        type: alertTypes.REQUIRED,
                        nodeTpe: nodeTypes
                    });
                }
            }
        }
        return alerts;
    }
function evaluateRequired ( 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 . REQUIRED , nodeType : nodeTypes [ i ] } ) ; } } } else { if ( ! hasNodeType ( ast , nodeTypes ) ) { alerts . push ( { type : alertTypes . REQUIRED , nodeTpe : nodeTypes } ) ; } } } return alerts ; }
Performs validation of the given javascript code checking that all the
 node types specified in nodeTypes are present.
Performs validation of the given javascript code checking that all the node types specified in nodeTypes are present .