lib/schema.js
function getArrayType (arr, self) {
  var compareDocs = false;
  var type = self.getType(arr, 0);

  if (isObject(type)) {
    type = new Schema(arr[0]);
    compareDocs = true;
  }

  var match = true;
  var element;
  var err;

  for (var i = 1; i < arr.length; ++i) {
    element = arr[i];

    if (isObject(element)) {
      if (compareDocs) {
        err = type.consume(element);
        if (err) throw err;
        continue;
      }

      if ('null' == type) {
        type = new Schema(element);
        compareDocs = true;
        continue;
      }

      match = false;
      break;
    }

    if (!equalType(self.getType(arr, i), type)) {
      match = false;
      break;
    }
  }

  if (match) return [type];
  return ['Mixed'];
}
function getArrayType (arr, self) {
  var compareDocs = false;
  var type = self.getType(arr, 0);

  if (isObject(type)) {
    type = new Schema(arr[0]);
    compareDocs = true;
  }

  var match = true;
  var element;
  var err;

  for (var i = 1; i < arr.length; ++i) {
    element = arr[i];

    if (isObject(element)) {
      if (compareDocs) {
        err = type.consume(element);
        if (err) throw err;
        continue;
      }

      if ('null' == type) {
        type = new Schema(element);
        compareDocs = true;
        continue;
      }

      match = false;
      break;
    }

    if (!equalType(self.getType(arr, i), type)) {
      match = false;
      break;
    }
  }

  if (match) return [type];
  return ['Mixed'];
}
function getArrayType ( arr , self ) { var compareDocs = false ; var type = self . getType ( arr , 0 ) ; if ( isObject ( type ) ) { type = new Schema ( arr [ 0 ] ) ; compareDocs = true ; } var match = true ; var element ; var err ; for ( var i = 1 ; i < arr . length ; ++ i ) { element = arr [ i ] ; if ( isObject ( element ) ) { if ( compareDocs ) { err = type . consume ( element ) ; if ( err ) throw err ; continue ; } if ( 'null' == type ) { type = new Schema ( element ) ; compareDocs = true ; continue ; } match = false ; break ; } if ( ! equalType ( self . getType ( arr , i ) , type ) ) { match = false ; break ; } } if ( match ) return [ type ] ; return [ 'Mixed' ] ; }
Determine the type of array

example return vals:

['Mixed']
['Buffer']
[{ name: 'String', count: 'Number' }]
Determine the type of array