0920732e60f3fbd95f31b3db3a776ad009dec474bee1a9a255714b6ab63009122fc1c7e3ec2ce544dd0a7b67ae34269801deb5c9be403f32f992aaf32ebab4 801 B

123456789101112131415161718192021
  1. import { isVNode, h } from 'vue';
  2. import { isArray, isFunction } from '@vue/shared';
  3. import { addUnit } from '../../../utils/dom/style.mjs';
  4. const sumReducer = (sum2, num) => sum2 + num;
  5. const sum = (listLike) => {
  6. return isArray(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  7. };
  8. const tryCall = (fLike, params, defaultRet = {}) => {
  9. return isFunction(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  10. };
  11. const enforceUnit = (style) => {
  12. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  13. style[key] = addUnit(style[key]);
  14. });
  15. return style;
  16. };
  17. const componentToSlot = (ComponentLike) => isVNode(ComponentLike) ? (props) => h(ComponentLike, props) : ComponentLike;
  18. export { componentToSlot, enforceUnit, sum, tryCall };
  19. //# sourceMappingURL=utils.mjs.map