lib/runner.js
function loadSchemaList(job, uris, callback) {
		uris = uris.filter(function (value) {
			return !!value;
		});

		if (uris.length === 0) {
			nextTick(function () {
				callback();
			});
			return;
		}

		var sweep = function () {
			if (uris.length === 0) {
				nextTick(callback);
				return;
			}
			forAsync(uris, function (uri, i, callback) {
				if (!uri) {
					out.writeln('> ' + style.error('cannot load') + ' "' + tweakURI(uri) + '"');
					callback();
				}
				out.writeln('> ' + style.accent('load') + ' + ' + tweakURI(uri));

				loader.load(uri, job.context.options, function (err, schema) {
					if (err) {
						return callback(err);
					}
					job.context.tv4.addSchema(uri, schema);
					uris = job.context.tv4.getMissingUris();
					callback();
				});
			}, function (err) {
				if (err) {
					job.error = err;
					return callback(null);
				}
				// sweep again
				sweep();
			});
		};
		sweep();
	}
function loadSchemaList(job, uris, callback) {
		uris = uris.filter(function (value) {
			return !!value;
		});

		if (uris.length === 0) {
			nextTick(function () {
				callback();
			});
			return;
		}

		var sweep = function () {
			if (uris.length === 0) {
				nextTick(callback);
				return;
			}
			forAsync(uris, function (uri, i, callback) {
				if (!uri) {
					out.writeln('> ' + style.error('cannot load') + ' "' + tweakURI(uri) + '"');
					callback();
				}
				out.writeln('> ' + style.accent('load') + ' + ' + tweakURI(uri));

				loader.load(uri, job.context.options, function (err, schema) {
					if (err) {
						return callback(err);
					}
					job.context.tv4.addSchema(uri, schema);
					uris = job.context.tv4.getMissingUris();
					callback();
				});
			}, function (err) {
				if (err) {
					job.error = err;
					return callback(null);
				}
				// sweep again
				sweep();
			});
		};
		sweep();
	}
function loadSchemaList ( job , uris , callback ) { uris = uris . filter ( function ( value ) { return ! ! value ; } ) ; if ( uris . length === 0 ) { nextTick ( function ( ) { callback ( ) ; } ) ; return ; } var sweep = function ( ) { if ( uris . length === 0 ) { nextTick ( callback ) ; return ; } forAsync ( uris , function ( uri , i , callback ) { if ( ! uri ) { out . writeln ( '> ' + style . error ( 'cannot load' ) + ' "' + tweakURI ( uri ) + '"' ) ; callback ( ) ; } out . writeln ( '> ' + style . accent ( 'load' ) + ' + ' + tweakURI ( uri ) ) ; loader . load ( uri , job . context . options , function ( err , schema ) { if ( err ) { return callback ( err ) ; } job . context . tv4 . addSchema ( uri , schema ) ; uris = job . context . tv4 . getMissingUris ( ) ; callback ( ) ; } ) ; } , function ( err ) { if ( err ) { job . error = err ; return callback ( null ) ; } // sweep again sweep ( ) ; } ) ; } ; sweep ( ) ; }
load and add batch of schema by uri, repeat until all missing are solved
load and add batch of schema by uri repeat until all missing are solved