Skip to content

Commit

Permalink
add isElement function
Browse files Browse the repository at this point in the history
  • Loading branch information
onokumus committed Apr 12, 2020
1 parent 8b90daa commit 53c05ff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function getSelectorFromElement(element: HTMLElement): string {
export function getSelectorFromElement(element: Element): string | null {
let selector = element.getAttribute("data-target");
if (!selector || selector === "#") {
selector = element.getAttribute("href") || "";
Expand Down Expand Up @@ -26,3 +26,7 @@ export function selectorArray(arrs: any[]): any[] {
}
return divArr;
}

export function isElement(element: unknown): element is Element {
return Boolean((element as Element).classList);
}

0 comments on commit 53c05ff

Please sign in to comment.