/**
 * @since Last modified: 2023-12-14 12:23:35
 * @namespace classes
 * @description Plan model. Can be created, canceled and implemented. Similar to subscription/publication models.
 * @see {@link https://codepen.io/axui/pen/mdvwQYo|demo @ codepen}
 */
'use strict';
import getDataType from './getDataType';
import trim from './trim';
import { Fun_any_any } from '../../../types/ax';
import getEl from './getEl';
import getClasses from './strToArr';
const classes: any = {
    get: function (classes: any) {
        return getClasses(classes);
    },
    add: function (target: any, classes: any, before: any) {
        let dom = getEl(target),
            arr = this.get(classes);
        if (!dom || arr.length === 0) { return false };
        arr.forEach((k: string) => {
            (before && before(k)) || !before ? dom.classList.add(k) : null;
        });
        return this;
    },
    remove: function (target: any, classes: any, before: any) {
        let dom = getEl(target),
            arr = this.get(classes);
        if (!dom || arr.length === 0) {
            return false;
        }
        arr.forEach((k:string) => {
            (before && before(k)) || !before ? dom.classList.remove(k) : null;
        });
        return this;
    }
}
export default classes;
