lib/model.js
function checkObject (obj) {
  if (util.isArray(obj)) {
    obj.forEach(function (o) {
      checkObject(o);
    });
  }

  if (typeof obj === 'object' && obj !== null) {
    Object.keys(obj).forEach(function (k) {
      checkKey(k, obj[k]);
      checkObject(obj[k]);
    });
  }
}
function checkObject (obj) {
  if (util.isArray(obj)) {
    obj.forEach(function (o) {
      checkObject(o);
    });
  }

  if (typeof obj === 'object' && obj !== null) {
    Object.keys(obj).forEach(function (k) {
      checkKey(k, obj[k]);
      checkObject(obj[k]);
    });
  }
}
function checkObject ( obj ) { if ( util . isArray ( obj ) ) { obj . forEach ( function ( o ) { checkObject ( o ) ; } ) ; } if ( typeof obj === 'object' && obj !== null ) { Object . keys ( obj ) . forEach ( function ( k ) { checkKey ( k , obj [ k ] ) ; checkObject ( obj [ k ] ) ; } ) ; } }
Check a DB object and throw an error if it's not valid
Works by applying the above checkKey function to all fields recursively
Check a DB object and throw an error if it s not valid Works by applying the above checkKey function to all fields recursively