function findData( files ) {
	var total;
	var count;
	var fpath;
	var out;
	var ext;
	var f;
	var i;

	total = files.length;
	count = 0;
	out = [];
	for ( i = 0; i < files.length; i++ ) {
		f = files[ i ];
		ext = extname( f );
		if (
			(
				ext === '.json' ||
				ext === '.txt'
			) &&
			RE.test( f )
		) {
			fpath = join( dataDir, f );
			debug( 'Possible data file: %s', f );
			fs.stat( fpath, onStatsClbk( f ) );
		} else {
			total -= 1;
		}
	}
	/**
	* Returns a callback to be invoked upon reading file stats.
	*
	* @private
	* @param {string} file - file name
	* @returns {Callback} callback
	*/
	function onStatsClbk( file ) {
		return onStats;

		/**
		* Callback invoked upon reading file stats.
		*
		* @private
		* @param {(Error|null)} error - error object
		* @param {Object} stats - file stats
		*/
		function onStats( error, stats ) {
			if ( error ) {
				debug( 'Encountered an error when attempting to read file stats: %s', error.message );
				throw error;
			}
			if ( stats.isFile() ) {
				count += 1;
				debug( 'Found data file: %s', file );
				out.push( file );
			} else {
				total -= 1;
			}
			if ( count === total ) {
				debug( 'Finished analyzing directory contents.' );
				datapackage( out.sort() );
			}
		}
	}
}
Finds data files.

@private
@param {StringArray} files - file names