UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

31 lines (25 loc) 783 B
'use strict'; /*! * @techmely/utils * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com> * MIT Licensed */ // src/isBrowser.ts function isBrowser() { return typeof window !== "undefined"; } // src/alias.ts var $ = (tag) => isBrowser() ? document.querySelector.call(void 0, tag) : null; var $$ = (tag) => isBrowser() ? document.querySelectorAll.call(void 0, tag) : null; HTMLElement.prototype.on = (a, b, c) => ( // @ts-expect-error Ignore typing check isBrowser() ? void 0 : null ); HTMLElement.prototype.of = (a, b, c) => ( // @ts-expect-error Ignore typing check isBrowser() ? void 0 : null ); HTMLElement.prototype.$ = (s) => isBrowser() ? void 0 : null; HTMLElement.prototype.$$ = (s) => isBrowser() ? void 0 : null; exports.$ = $; exports.$$ = $$;