UNPKG

@ozen-ui/kit

Version:

React component library

27 lines (26 loc) 784 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.matchSizeIndicatorToAvatar = exports.getInitials = void 0; var getInitials = function (name) { var _a, _b, _c; var parts = name.split(' '); var initials; if (parts.length === 1) { initials = ((_a = parts[0]) === null || _a === void 0 ? void 0 : _a.charAt(0)) || ''; } else { initials = ((_b = parts.shift()) !== null && _b !== void 0 ? _b : '').charAt(0) + ((_c = parts.pop()) !== null && _c !== void 0 ? _c : '').charAt(0); } return initials.toUpperCase(); }; exports.getInitials = getInitials; exports.matchSizeIndicatorToAvatar = { '4xs': 'xs', '3xs': 'xs', '2xs': 'xs', xs: 's', s: 's', m: 's', l: 'm', xl: 'm', };