UNPKG

@findify/react-components

Version:
19 lines (16 loc) 781 B
/** * @module components/RangeFacet */ import unescape from 'lodash/unescape'; import formatCurrency from "../../helpers/formatCurrency"; var identity = function identity(i) { return i; }; var createLabel = function createLabel(from, to, config, fx) { return from && to && "".concat(fx(from), " - ").concat(fx(to)) || from && !to && "".concat(fx(from), " ").concat(unescape(config.getIn(['translations', 'range.up']))) || !from && to && "".concat(unescape(config.getIn(['translations', 'range.under'])), " ").concat(fx(to)); }; export default (function (_ref) { var item = _ref.item, config = _ref.config; return createLabel(item.get('from'), item.get('to'), config, item.get('name') === 'price' && formatCurrency(config.get('currency').toJS()) || identity); });