export class BEM {
    data;
    parent;
    otherClass = [];
    constructor(parent, data = {}, className = '') {
        this.parent = parent;
        this.data = data;
        this.otherClass = className.split(',');
    }
    append(className) {
        if (!className)
            return;
        this.otherClass = [...this.otherClass, className];
    }
    className(className, data = {}) {
        return Object.entries(data).reduce((prv, [key, value]) => {
            if (value) {
                return [...prv, key];
            }
            return prv;
        }, [className]).join(" ");
    }
    toString() {
        return Object.entries(this.data).reduce((prv, [key, value]) => {
            if (value) {
                return [...prv, key];
            }
            return prv;
        }, [this.parent, ...this.otherClass]).join(" ");
    }
}
