lib/api/JsonSchemaLib/read.js
function readReferencedFiles (schema, callback) {
  var filesBeingRead = [], filesToRead = [];
  var file, i;

  // Check the state of all files in the schema
  for (i = 0; i < schema.files.length; i++) {
    file = schema.files[i];

    if (file[__internal].state < STATE_READING) {
      filesToRead.push(file);
    }
    else if (file[__internal].state < STATE_READ) {
      filesBeingRead.push(file);
    }
  }

  // Have we finished reading everything?
  if (filesToRead.length === 0 && filesBeingRead.length === 0) {
    return safeCall(finished, schema, callback);
  }

  // In sync mode, just read the next file.
  // In async mode, start reading all files in the queue
  var numberOfFilesToRead = schema.config.sync ? 1 : filesToRead.length;

  for (i = 0; i < numberOfFilesToRead; i++) {
    file = filesToRead[i];
    safeCall(readFile, file, callback);
  }
}
function readReferencedFiles (schema, callback) {
  var filesBeingRead = [], filesToRead = [];
  var file, i;

  // Check the state of all files in the schema
  for (i = 0; i < schema.files.length; i++) {
    file = schema.files[i];

    if (file[__internal].state < STATE_READING) {
      filesToRead.push(file);
    }
    else if (file[__internal].state < STATE_READ) {
      filesBeingRead.push(file);
    }
  }

  // Have we finished reading everything?
  if (filesToRead.length === 0 && filesBeingRead.length === 0) {
    return safeCall(finished, schema, callback);
  }

  // In sync mode, just read the next file.
  // In async mode, start reading all files in the queue
  var numberOfFilesToRead = schema.config.sync ? 1 : filesToRead.length;

  for (i = 0; i < numberOfFilesToRead; i++) {
    file = filesToRead[i];
    safeCall(readFile, file, callback);
  }
}
function readReferencedFiles ( schema , callback ) { var filesBeingRead = [ ] , filesToRead = [ ] ; var file , i ; // Check the state of all files in the schema for ( i = 0 ; i < schema . files . length ; i ++ ) { file = schema . files [ i ] ; if ( file [ __internal ] . state < STATE_READING ) { filesToRead . push ( file ) ; } else if ( file [ __internal ] . state < STATE_READ ) { filesBeingRead . push ( file ) ; } } // Have we finished reading everything? if ( filesToRead . length === 0 && filesBeingRead . length === 0 ) { return safeCall ( finished , schema , callback ) ; } // In sync mode, just read the next file. // In async mode, start reading all files in the queue var numberOfFilesToRead = schema . config . sync ? 1 : filesToRead . length ; for ( i = 0 ; i < numberOfFilesToRead ; i ++ ) { file = filesToRead [ i ] ; safeCall ( readFile , file , callback ) ; } }
Reads any files in the schema that haven't been read yet.

@param {Schema} schema
@param {function} callback
Reads any files in the schema that haven t been read yet .