@zohodesk/components
Version:
Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development
18 lines (16 loc) • 501 B
JavaScript
export function bind(...handlers) {
handlers.forEach(handler => {
this[handler] = this[handler].bind(this);
});
}
export function formatValue(values = [], valueField = 'id', textField = 'name') {
return values && values.map(value => {
let formattedValue = value;
if (typeof value === 'string' || typeof value === 'number') {
formattedValue = {};
formattedValue[valueField] = value;
formattedValue[textField] = value;
}
return formattedValue;
}) || [];
}