File size: 327 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import type { Option } from 'calypso/landing/subscriptions/components/sort-controls';

export const getOptionLabel = < T >( options: Option< T >[], value: T ) => {
	const foundOption = options.find( ( option ) => option.value === value )?.label;
	if ( ! foundOption ) {
		return options[ 0 ].label;
	}

	return foundOption;
};