function analyze( options, clbk ) {
	var files;
	var gopts;
	var opts;
	var err;
	var dir;
	var cb;

	opts = copy( defaults );
	if ( arguments.length < 2 ) {
		cb = options;
	} else {
		err = validate( opts, options );
		if ( err ) {
			throw err;
		}
		cb = clbk;
	}
	if ( !isFunction( cb ) ) {
		throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', cb ) );
	}
	debug( 'Options: %s', JSON.stringify( opts ) );

	if ( opts.dir ) {
		dir = resolve( cwd(), opts.dir );
	} else {
		dir = cwd();
	}
	debug( 'Search directory: %s', dir );

	gopts = {
		'cwd': dir,
		'ignore': opts.ignore,
		'realpath': true // return absolute file paths
	};
	debug( 'Glob options: %s', JSON.stringify( gopts ) );

	debug( 'Searching for files...' );
	glob( opts.pattern, gopts, onGlob );

	/**
	* Callback invoked after matching files.
	*
	* @private
	* @param {(Error|null)} error - error object
	* @param {(EmptyArray|StringArray)} names - list of matching files
	* @returns {void}
	*/
	function onGlob( error, names ) {
		var sopts;
		if ( error ) {
			debug( 'Encountered an error when searching for files: %s', error.message );
			return done( error );
		}
		debug( 'Found %d files.', names.length );
		if ( names.length === 0 ) {
			return done();
		}
		files = names; // cache reference to file list
		sopts = {
			'cumulative': opts.cumulative
		};
		debug( 'Analysis options: %s', JSON.stringify( sopts ) );

		debug( 'Performing analysis...' );
		lloc( names, sopts, onResults );
	}

	/**
	* Callback invoked upon analyzing a file list.
	*
	* @private
	* @param {(Error|null)} error - error object
	* @param {(Object|NonNegativeIntegerArray)} results - analysis results
	* @returns {void}
	*/
	function onResults( error, results ) {
		var i;
		if ( error ) {
			debug( 'Encountered an error when analyzing files: %s', error.message );
			return done( error );
		}
		debug( 'Successfully analyzed files.' );
		for ( i = 0; i < results.length; i++ ) {
			// NOTE: We assume that results are returned in the same order as the provided file list...
			results[ i ] = [ files[ i ], results[ i ] ];
		}
		done( null, results );
	}

	/**
	* Callback invoked upon completion.
	*
	* @private
	* @param {(Error|null)} error - error object
	* @param {(Object|ArrayArray)} results - analysis results
	* @returns {void}
	*/
	function done( error, results ) {
		if ( error ) {
			return cb( error );
		}
		debug( 'Finished analysis.' );
		if ( results ) {
			return cb( null, results );
		}
		if ( opts.cumulative ) {
			return cb( null, null );
		}
		return cb( null, [] );
	}
}
Asynchronously calculates logical lines of code (LLOC) on a file glob.

@param {Options} [options] - function options
@param {string} [options.dir] - root directory from which to search for files
@param {string} [options.pattern='**\/*.js'] - glob pattern
@param {StringArray} [options.ignore] - glob pattern(s) to exclude matches
@param {boolean} [options.cumulative=true] - boolean indicating whether to perform a cumulative analysis
@param {Callback} clbk - callback to invoke upon completing analysis
@throws {TypeError} options argument must be an object
@throws {TypeError} must provide valid options
@throws {TypeError} callback argument must be a function
@returns {void}

@example
var opts = {
    'dir': __dirname
};

analyze( opts, clbk );

function clbk( error, results ) {
    if ( error ) {
        throw error;
    }
    if ( results ) {
        console.log( JSON.stringify( results ) );
    }
}