lib/namespace.js
function(typeName, template){
    if (!(template instanceof ValueTemplate)){
      template = ValueTemplate.parse(template, {namespace:this});
    }
    class UserDefinedTemplate extends ValueTemplate{
      constructor(defaultValue, validator){
        super(typeName, defaultValue, validator);
        this.template = template;
      }

      validate(value, options){
        return this.template.validate(value, options);
      }
    }
    this.names[typeName] = UserDefinedTemplate;
    return this;
  }
function(typeName, template){
    if (!(template instanceof ValueTemplate)){
      template = ValueTemplate.parse(template, {namespace:this});
    }
    class UserDefinedTemplate extends ValueTemplate{
      constructor(defaultValue, validator){
        super(typeName, defaultValue, validator);
        this.template = template;
      }

      validate(value, options){
        return this.template.validate(value, options);
      }
    }
    this.names[typeName] = UserDefinedTemplate;
    return this;
  }
function ( typeName , template ) { if ( ! ( template instanceof ValueTemplate ) ) { template = ValueTemplate . parse ( template , { namespace : this } ) ; } class UserDefinedTemplate extends ValueTemplate { constructor ( defaultValue , validator ) { super ( typeName , defaultValue , validator ) ; this . template = template ; } validate ( value , options ) { return this . template . validate ( value , options ) ; } } this . names [ typeName ] = UserDefinedTemplate ; return this ; }
Defines a template type.
@param {String} typeName - name of the new type.
@param {*|ValueTemplate} template - base template of the new type.
Defines a template type .