lib/schema/index.js
function Schema (sc, size) {
  if (!(this instanceof Schema)) return new Schema(sc);
  debug('======BUILDING PHASE======');
  helpers.validate(sc);
  debug('schema size=%d being built', size);
  this._schema = this;
  this._document = helpers.build(sc, '$root', this);
  this._state = { // serve as global state
    index: -1,
    size: size,
    counter: []
  };
  debug('======BUILDING ENDS======');
}
function Schema (sc, size) {
  if (!(this instanceof Schema)) return new Schema(sc);
  debug('======BUILDING PHASE======');
  helpers.validate(sc);
  debug('schema size=%d being built', size);
  this._schema = this;
  this._document = helpers.build(sc, '$root', this);
  this._state = { // serve as global state
    index: -1,
    size: size,
    counter: []
  };
  debug('======BUILDING ENDS======');
}
function Schema ( sc , size ) { if ( ! ( this instanceof Schema ) ) return new Schema ( sc ) ; debug ( '======BUILDING PHASE======' ) ; helpers . validate ( sc ) ; debug ( 'schema size=%d being built' , size ) ; this . _schema = this ; this . _document = helpers . build ( sc , '$root' , this ) ; this . _state = { // serve as global state index : - 1 , size : size , counter : [ ] } ; debug ( '======BUILDING ENDS======' ) ; }
Internal representation of a user-defined schema
@class
@memberOf module:schema
@param {object} sc
@param {number} size
Internal representation of a user - defined schema