14 lines
342 B
JavaScript
14 lines
342 B
JavaScript
import { isValidElement } from 'react';
|
|
function convertToTooltipProps(tooltip) {
|
|
// isNil
|
|
if (tooltip === undefined || tooltip === null) {
|
|
return null;
|
|
}
|
|
if (typeof tooltip === 'object' && ! /*#__PURE__*/isValidElement(tooltip)) {
|
|
return tooltip;
|
|
}
|
|
return {
|
|
title: tooltip
|
|
};
|
|
}
|
|
export default convertToTooltipProps; |