bin/schema.js
function Schema(config, data) {
    const controllers = data.controllers;
    const length = controllers.length;

    this.FullyTyped = FullyTyped;

    // apply controllers to this schema
    for (let i = 0; i < length; i++) controllers[i].call(this, config);

    // add additional properties
    if (config._extension_ && typeof config._extension_ === 'object') {
        const self = this;
        Object.keys(config._extension_).forEach(function(key) {
            self[key] = config._extension_[key];
        });
    }

    // store protected data with schema
    const protect = Object.assign({}, data);

    // create and store hash
    const options = getNormalizedSchemaConfiguration(this);
    protect.hash = crypto
        .createHash('sha256')
        .update(JSON.stringify(prepareForHash(options)))
        .digest('hex');
    instances.set(this, protect);

    /**
     * @name Schema#config
     * @type {object}
     */
    Object.defineProperty(this, 'config', {
        get: function() {
            return util.copy(config);
        }
    });
}
function Schema(config, data) {
    const controllers = data.controllers;
    const length = controllers.length;

    this.FullyTyped = FullyTyped;

    // apply controllers to this schema
    for (let i = 0; i < length; i++) controllers[i].call(this, config);

    // add additional properties
    if (config._extension_ && typeof config._extension_ === 'object') {
        const self = this;
        Object.keys(config._extension_).forEach(function(key) {
            self[key] = config._extension_[key];
        });
    }

    // store protected data with schema
    const protect = Object.assign({}, data);

    // create and store hash
    const options = getNormalizedSchemaConfiguration(this);
    protect.hash = crypto
        .createHash('sha256')
        .update(JSON.stringify(prepareForHash(options)))
        .digest('hex');
    instances.set(this, protect);

    /**
     * @name Schema#config
     * @type {object}
     */
    Object.defineProperty(this, 'config', {
        get: function() {
            return util.copy(config);
        }
    });
}
function Schema ( config , data ) { const controllers = data . controllers ; const length = controllers . length ; this . FullyTyped = FullyTyped ; // apply controllers to this schema for ( let i = 0 ; i < length ; i ++ ) controllers [ i ] . call ( this , config ) ; // add additional properties if ( config . _extension_ && typeof config . _extension_ === 'object' ) { const self = this ; Object . keys ( config . _extension_ ) . forEach ( function ( key ) { self [ key ] = config . _extension_ [ key ] ; } ) ; } // store protected data with schema const protect = Object . assign ( { } , data ) ; // create and store hash const options = getNormalizedSchemaConfiguration ( this ) ; protect . hash = crypto . createHash ( 'sha256' ) . update ( JSON . stringify ( prepareForHash ( options ) ) ) . digest ( 'hex' ) ; instances . set ( this , protect ) ; /**
     * @name Schema#config
     * @type {object}
     */ Object . defineProperty ( this , 'config' , { get : function ( ) { return util . copy ( config ) ; } } ) ; }
Create a schema instance.
@param {Object} config The configuration for the schema.
@param {ControllerData} data
@constructor
Create a schema instance .