examples/models.js
function(prototypeProps, constructorProps) {
    if (typeof prototypeProps.Meta == 'undefined' ||
        typeof prototypeProps.Meta.name == 'undefined') {
      throw new Error('When extending Model, you must provide a name via a Meta object.')
    }

    var options = new ModelOptions(prototypeProps.Meta)
    delete prototypeProps.Meta

    for (var prop in prototypeProps) {
      if (prototypeProps.hasOwnProperty(prop)) {
        var field = prototypeProps[prop]
        if (field instanceof Field || field instanceof Rel) {
          field.name = prop
          options.fields.push(field)
          delete prototypeProps[prop]
        }
      }
    }

    prototypeProps._meta = constructorProps._meta = options
  }
function(prototypeProps, constructorProps) {
    if (typeof prototypeProps.Meta == 'undefined' ||
        typeof prototypeProps.Meta.name == 'undefined') {
      throw new Error('When extending Model, you must provide a name via a Meta object.')
    }

    var options = new ModelOptions(prototypeProps.Meta)
    delete prototypeProps.Meta

    for (var prop in prototypeProps) {
      if (prototypeProps.hasOwnProperty(prop)) {
        var field = prototypeProps[prop]
        if (field instanceof Field || field instanceof Rel) {
          field.name = prop
          options.fields.push(field)
          delete prototypeProps[prop]
        }
      }
    }

    prototypeProps._meta = constructorProps._meta = options
  }
function ( prototypeProps , constructorProps ) { if ( typeof prototypeProps . Meta == 'undefined' || typeof prototypeProps . Meta . name == 'undefined' ) { throw new Error ( 'When extending Model, you must provide a name via a Meta object.' ) } var options = new ModelOptions ( prototypeProps . Meta ) delete prototypeProps . Meta for ( var prop in prototypeProps ) { if ( prototypeProps . hasOwnProperty ( prop ) ) { var field = prototypeProps [ prop ] if ( field instanceof Field || field instanceof Rel ) { field . name = prop options . fields . push ( field ) delete prototypeProps [ prop ] } } } prototypeProps . _meta = constructorProps . _meta = options }
Prepares a ModelOptions for the extended Model and places it in a
_meta property on the prototype and constructor.
Prepares a ModelOptions for the extended Model and places it in a _meta property on the prototype and constructor .