Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 2x 2x 4x 4x 2x 2x | /**
* Apply the classes to an HTML elements if the props keyed by the name of the class
* has a value that evaluates to true
* @param element
* @param props
*/
export default function applyClasses(element: HTMLElement, props: Record<string, boolean>): void {
for (const key in props) {
Eif (props.hasOwnProperty(key)) {
if (props[key] === true) {
element.classList.add(key);
}
else {
element.classList.remove(key);
}
}
}
} |