UNPKG

toastr2

Version:

ToastrJS is a JavaScript library for Gnome / Growl type non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be customized and extended.

11 lines (7 loc) 304 B
import flat from 'array.prototype.flat'; const addClasses = (element: HTMLElement, ...classes: (string | string[])[]): void => { const classesToAdd: string[] = flat(classes) .map(classToAdd => classToAdd.split(' ')); element.classList.add(...flat(classesToAdd)); }; export default addClasses;