@scania/tegel-cli
Version:
CLI tool for copying and transforming Tegel components with custom prefixes
11 lines (9 loc) • 347 B
text/typescript
/**
* Checks if the provided element has a slotted element
* in the slot with the corresponding slotName
* @param slotName the name of the slot.
* @param element the element to look for the slot within.
*/
const hasSlot = (slotName: string, element: HTMLElement) =>
!!element.querySelector(`[slot="${slotName}"]`);
export default hasSlot;