// @ts-check /** * Utility for query selector * * @param {string} query * @param {HTMLElement | null} [container] * @returns {HTMLElement} */ function qs(query, container) { var target = (container) ? container : document; /** @type {HTMLElement | null} */ var result = target.querySelector(query); if (result) { return result; } throw new Error(`No element ${query}`); } /** * Utility for query selector all * * @param {string} query * @param {HTMLElement | null} [container] * @returns {NodeListOf} */ function qsa(query, container) { var target = (container) ? container : document; /** @type {NodeListOf} */ var result = target.querySelectorAll(query); return result; } export { qs, qsa };