UNPKG

@quillforms/utils

Version:
30 lines (28 loc) 753 B
/** * QuillForms Dependencies */ /** * Internal Dependencies */ import { isValidIcon } from './is-valid-icon'; /** * Function that receives an icon during the registration * and returns a new icon object that is normalized so we can rely on just on possible icon structure * in the codebase. * * @param {IconRenderer} icon Render behavior of icon; * one of a Dashicon slug, an element, or a * component. * * @return {IconDescriptor} Object describing the icon. */ export function normalizeIconObject(icon) { if (!icon) icon = 'plus'; if (isValidIcon(icon)) { return { src: icon }; } return icon; } //# sourceMappingURL=normalize-icon-object.js.map