import { ref, computed } from 'vue';

const useOptionsFilter = _ref => {
  let {
    options,
    filter,
    rootProps
  } = _ref;
  const filterText = ref('');
  const displayOptions = computed(() => {
    if (!rootProps.filterable) {
      return options.value;
    }
    return options.value.filter(option => filter(filterText.value, option));
  });
  return {
    filterText,
    displayOptions
  };
};

export { useOptionsFilter };
