bin/fully-typed.js
function FullyTyped (configuration) {
    if (arguments.length === 0 || configuration === null) configuration = {};

    // validate input parameter
    if (!util.isPlainObject(configuration)) {
        throw Error('If provided, the schema configuration must be a plain object. Received: ' + configuration);
    }

    // get a copy of the configuration
    const config = util.copy(configuration);

    // if type is not specified then use the default
    if (!config.type) config.type = 'typed';

    // get the controller data
    const data = FullyTyped.controllers.get(config.type);

    // type is invalid
    if (!data) throw Error('Unknown type: ' + config.type);

    // return a schema object
    return new Schema(config, data);
}
function FullyTyped (configuration) {
    if (arguments.length === 0 || configuration === null) configuration = {};

    // validate input parameter
    if (!util.isPlainObject(configuration)) {
        throw Error('If provided, the schema configuration must be a plain object. Received: ' + configuration);
    }

    // get a copy of the configuration
    const config = util.copy(configuration);

    // if type is not specified then use the default
    if (!config.type) config.type = 'typed';

    // get the controller data
    const data = FullyTyped.controllers.get(config.type);

    // type is invalid
    if (!data) throw Error('Unknown type: ' + config.type);

    // return a schema object
    return new Schema(config, data);
}
function FullyTyped ( configuration ) { if ( arguments . length === 0 || configuration === null ) configuration = { } ; // validate input parameter if ( ! util . isPlainObject ( configuration ) ) { throw Error ( 'If provided, the schema configuration must be a plain object. Received: ' + configuration ) ; } // get a copy of the configuration const config = util . copy ( configuration ) ; // if type is not specified then use the default if ( ! config . type ) config . type = 'typed' ; // get the controller data const data = FullyTyped . controllers . get ( config . type ) ; // type is invalid if ( ! data ) throw Error ( 'Unknown type: ' + config . type ) ; // return a schema object return new Schema ( config , data ) ; }
Validate a value against the schema and throw an error if encountered.
@function
@name FullyTyped#validate
@param {*} value
@param {string} [prefix='']
@throws {Error}
 
Get a typed schema.
@constructor
@param {object, object[]} [configuration={}]
@returns {FullyTyped}
Validate a value against the schema and throw an error if encountered .