/**
 * @since Last modified: 2024-09-04 19:40:12
 * @function getClasses
 * @param {string|array} data  - Class string or class array.
 * @returns {array} - Return a classes array.
 * @see {@link https://codepen.io/axui/pen/dyaEQyd|demo @ codepen}
 * @example
 * ax.getClasses('demo01,demo02');
 * <!--return ['demo01','demo02']-->
 */
'use strict';
import ax from "../ax";
import config from "../global/config";
import getDataType from "./getDataType";
import trim from "./trim";
const getClasses = (data: string | string[]):string[] => {
    let dataType = getDataType(data),
        separator: string,
        result: string[] = [];
    if (dataType === 'Array') {
        result = (data as any).filter((k: any) => k && typeof k === 'string');
    } else {
        data = trim((data as string));
        separator = data.includes(config.splitHyphen) ? config.splitHyphen : config.wordHyphen;
        result = data.split(separator);
    }
    return result.map((k: string) => trim(k, 'global')).filter(Boolean);
}
export default getClasses;
