function prunePackage( pkg, level ) {
	var idx = nthIndex( pkg, '/', level + 1 );
	if ( idx === -1 ) {
		return pkg;
	}
	return pkg.substring( 0, idx );
}
Prunes a package name to an ancestor at the chosen level of the tree.

@private
@param {string} pkg - package tree path
@param {number} level - desired dependency level
@returns {string} ancestor package