@zohodesk/utils
Version:
Unified Component Library - Utils
16 lines (14 loc) • 564 B
JavaScript
export default (function (_ref, defaultCustomId) {
let {
customId,
customIdPrefix = "",
customIdSuffix = ""
} = _ref;
let otherCustomOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
let returnId = customId;
if (typeof defaultCustomId === "function") {
let options = ['', customIdPrefix, customIdSuffix, ...otherCustomOption];
returnId = defaultCustomId.apply(null, options); //returnId = defaultCustomId`${customIdPrefix} ${customIdSuffix}`;
}
return returnId ? returnId.toLowerCase() : null;
});