function resolve( results, options, clbk ) {
	var errFLG;
	var count;
	var gopts;
	var len;
	var pkg;
	var i;

	len = results.length;
	count = 0;

	debug( 'Resolving %d packages...', len );
	for ( i = 0; i < len; i++ ) {
		pkg = results[ i ].pkg;

		debug( 'Resolving package: %s (%d of %d)...', pkg, i+1, len );
		gopts = {
			'cwd': results[ i ].dir,
			'ignore': options.ignore,
			'realpath': true // absolute paths
		};
		debug( 'Glob options: %s', JSON.stringify( gopts ) );
		glob( options.pattern, gopts, getClbk1( i ) );
	}

	/**
	* Returns a callback to be invoked upon matching files.
	*
	* @private
	* @param {NonNegativeInteger} idx - index
	* @returns {Callback} callback
	*/
	function getClbk1( idx ) {
		var pkg = results[ idx ].pkg;
		var k = idx + 1;
		return onGlob;

		/**
		* Callback invoked upon matching files.
		*
		* @private
		* @param {(Error|null)} error - error object
		* @param {(StringArray|EmptyArray)} files - matched files
		* @returns {void}
		*/
		function onGlob( error, files ) {
			var opts;
			if ( error ) {
				debug( 'Encountered an error when attempting to match files for package: %s (%d of %d). Error: %s', pkg, k, len, error.message );
				return done( error );
			}
			if ( files.length === 0 ) {
				debug( 'No files matched for package: %s (%d of %d).', pkg, k, len );
				return done();
			}
			debug( 'Successfully matched files for package: %s (%d of %d).', pkg, k, len );

			debug( 'Removing previously resolved files...' );
			files = setDifference( files, results[ idx ].files );
			if ( files.length === 0 ) {
				debug( 'Package does not contain dev files: %s (%d of %d).', pkg, k, len );
				return done();
			}
			opts = {
				'walk': false, // walking is not necessary, as we globbed for everything
				'builtins': options.builtins
			};
			debug( 'Resolve options: %s', JSON.stringify( opts ) );
			pkgDeps( files, opts, getClbk2( idx ) );
		}
	}

	/**
	* Returns a callback to be invoked upon resolving package dependencies.
	*
	* @private
	* @param {NonNegativeInteger} idx - index
	* @returns {Callback} callback
	*/
	function getClbk2( idx ) {
		var pkg = results[ idx ].pkg;
		var k = idx + 1;
		return onDeps;

		/**
		* Callback invoked upon resolving dependencies.
		*
		* @private
		* @param {(Error|null)} error - error object
		* @param {ObjectArray} res - results
		* @returns {void}
		*/
		function onDeps( error, res ) {
			if ( error ) {
				debug( 'Encountered an error when resolving package dev dependencies: %s (%d of %d). Error: %s', pkg, k, len, error.message );
				return done( error );
			}
			debug( 'Successfully resolved package dev dependencies: %s (%d of %d).', pkg, k, len );

			res = transform( res );
			results[ idx ].files = append( results[ idx ].files, res.files );

			// Only include as dev dependencies dependencies which are not already listed as deps:
			results[ idx ].devDeps = setDifference( res.deps, results[ idx ].deps ); // eslint-disable-line max-len

			done();
		}
	}

	/**
	* Callback invoked upon resolving dependencies.
	*
	* @private
	* @param {(Error|null)} [error] - error object
	* @returns {void}
	*/
	function done( error ) {
		if ( errFLG ) {
			return;
		}
		if ( error ) {
			errFLG = true;
			return clbk( error );
		}
		count += 1;
		debug( 'Resolved %d of %d packages.', count, len );
		if ( count === len ) {
			debug( 'Resolved all packages.' );
			return clbk( null, results );
		}
	}
}
Resolves package dev dependencies.

@private
@param {ObjectArray} results - results object
@param {Options} options - function options
@param {Callback} clbk - callback