"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Classy = /** @class */ (function () {
    function Classy() {
        return;
    }
    Classy.prototype.hasClass = function (ele, cls) {
        if (!ele || typeof ele.className === "undefined") {
            return false;
        }
        return (ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)"))) ? true : false;
    };
    /**
     * Adds class to an element
     *
     * @param ele
     * @param cls
     * @returns {boolean}
     */
    Classy.prototype.addClass = function (ele, cls) {
        if (!ele) {
            return false;
        }
        // if (!this.hasClass(ele, cls)) { ele.className += " " + cls; }
        ele.classList.add(cls);
    };
    /**
     * Removes class from element
     *
     * @param ele
     * @param cls
     * @returns {boolean}
     */
    Classy.prototype.removeClass = function (ele, cls) {
        if (!ele) {
            return false;
        }
        // if (this.hasClass(ele, cls)) {
        //     let reg: any = new RegExp(`(\\s|^)${cls}(\\s|$)`);
        //     ele.className = ele.className.replace(reg, " ");
        // }
        ele.classList.remove(cls);
    };
    return Classy;
}());
exports.default = Classy;
//# sourceMappingURL=Classy.js.map