mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 06:08:10 +00:00
16 lines
397 B
TypeScript
16 lines
397 B
TypeScript
import { toKebabCase } from 'core/utils';
|
|
|
|
export default function querys(proto: Object, key: string): any {
|
|
const kebab: string = toKebabCase(key);
|
|
return Object.defineProperty(proto, key, {
|
|
configurable: true,
|
|
get() {
|
|
return findQuerys(this, kebab);
|
|
},
|
|
});
|
|
}
|
|
|
|
function findQuerys(element: HTMLElement, key: string): NodeListOf<HTMLElement> {
|
|
return element.querySelectorAll(key);
|
|
}
|