UNPKG

ssc-refer

Version:
27 lines (21 loc) 562 B
import { head } from 'lodash'; import getOptionLabel from './getOptionLabel'; function getInputText(_ref) { var activeItem = _ref.activeItem, labelKey = _ref.labelKey, multiple = _ref.multiple, selected = _ref.selected, text = _ref.text; if (multiple) { return text; } if (activeItem) { return getOptionLabel(activeItem, labelKey); } var selectedItem = !!selected.length && head(selected); if (selectedItem) { return getOptionLabel(selectedItem, labelKey); } return text; } export default getInputText;