function first( paths, dir, done ) {
	var child;
	var spath;
	var idx;
	var out;

	out = [];

	// Start at a base directory and continue moving up through each parent directory...
	spath = resolve( dir, paths[ 0 ] );

	idx = 1; // index of next path
	exists( spath, onExists );

	/**
	* Callback invoked after checking for path existence.
	*
	* @private
	* @param {(Error|null)} error - error object
	* @param {boolean} bool - boolean indicating if a path exists
	* @returns {void}
	*/
	function onExists( error, bool ) { // eslint-disable-line node/handle-callback-err
		if ( bool ) {
			out.push( spath );
			return done( null, out );
		}
		// If we have traversed all paths at the current directory level, resolve parent directory...
		if ( idx === paths.length ) {
			// Resolve a parent directory:
			child = dir;
			dir = resolve( dir, '..' );

			// If we have already reached root, we cannot resolve any higher directories...
			if ( child === dir ) {
				return done( null, out );
			}
			idx = 0;
		}
		spath = resolve( dir, paths[ idx ] );
		idx += 1;
		exists( spath, onExists );
	}
}
Asynchronously resolves the first path match from a set of paths by walking parent directories.

@private
@param {Array<string>} paths - paths to resolve
@param {string} dir - base directory
@param {Callback} done - callback to invoke after resolving paths
@returns {void}