const push = (name, action, customisation = null) => { if (typeof(action) !== "function") { throw new TypeError("Action must be an function."); } if (typeof(name) !== "string") { throw new TypeError("Name of the push must be string."); } if (customisation !== null && typeof(customisation) !== "function") { throw new TypeError("Customisation must be null or function"); } const target = document.createElement("button"); target.type = "button"; target.name = name; target.id = "push-" + name; target.innerText = name .toUpperCase() .replaceAll("-", " ") .replaceAll("_", " "); target.classList.add("push"); target.addEventListener("click", action); if (customisation) { customisation(target); } return target; }; export { push };