new AnyNode(){AnyNode}
The AnyNode class represents a value that can be anything
Returns:
AnyNode instance.Methods
-
generate(context)
-
Generate the code for this node
Name Type Description context
object the generation context for this node
Example
// Create a Custom validator assert = require('assert'), Compiler = require('vitesse').Compiler, AnyNode = require('vitesse').AnyNode, CustomNode = require('../lib/custom'); var schema = new AnyNode(null, null, {typeCheck:true}) var compiler = new Compiler({}); // Compile the AST var func = compiler.compile(schema, {}); // Validate {} var results = func.validate({}); assert.equal(0, results.length); // Validate number 100 var results = func.validate(100); assert.equal(0, results.length);
-
path(){array}
-
Return the current object path
Returns:
array containing the path to this node
-
setTypeCheck(typeCheck){AnyNode}
-
Type check value
Name Type Description typeCheck
boolean type check value