@dr.pogodin/react-utils
Version:
Collection of generic ReactJS components and utils
12 lines (10 loc) • 382 B
JavaScript
// The stuff common between different dropdown implementations.
function isValue(x) {
const type = typeof x;
return type === 'number' || type === 'string';
}
/** Returns option value and name as a tuple. */
export function optionValueName(option) {
return isValue(option) ? [option, option] : [option.value, option.name ?? option.value];
}
//# sourceMappingURL=common.js.map