function extractPackage( filepath ) {
	var parts;
	var idx;
	var i;

	filepath = replace( filepath, RE_STDLIB_PREFIX, '' );
	parts = filepath.split( '/' );

	// Remove the last part as it's a file name:
	parts.pop();

	// Find the index of the first occurrence of certain package subdirectories:
	idx = -1;
	for ( i = 0; i < parts.length; i++ ) {
		if (
			parts[ i ] === 'bin' ||
			parts[ i ] === 'benchmark' ||
			parts[ i ] === 'data' ||
			parts[ i ] === 'docs' ||
			parts[ i ] === 'etc' ||
			parts[ i ] === 'examples' ||
			parts[ i ] === 'include' ||
			parts[ i ] === 'lib' ||
			parts[ i ] === 'scripts' ||
			parts[ i ] === 'src' ||
			parts[ i ] === 'test'
		) {
			idx = i;
			break;
		}
	}

	// If we found a package subdirectory, return the package path up to that point:
	if ( idx !== -1 ) {
		parts.length = idx;
	}
	return parts.join( '/' );
}
Extracts a package path from a file path.

@private
@param {string} filepath - input file path to process
@returns {string} package path

@example
var path = 'lib/node_modules/@stdlib/complex/float64/base/assert/is-equal/lib/main.js';
var result = extractPackage( path );
// returns 'complex/float64/base/assert/is-equal'