UNPKG

@piiano/forms

Version:
2 lines (1 loc) 413 B
function n(t,o){const e=typeof t=="string"?document.querySelector(t):t;if(e===null)throw Error(`Failed to select element using the "${t}" selector.`);if(!(e instanceof HTMLElement))throw Error(`Selected element must be an HTMLElement but found "${typeof e}"`);if(e.tagName!==o.toUpperCase())throw Error(`Selected element must be a "${o}" but found "${e.tagName.toLowerCase()}"`);return e}export{n as getElement};