/**
 * @since Last modified: 2024-01-18 16:17:08
 * @function getEls
 * @description Get the node array.
 * @param {*} data  - It can be a single node selector or a node array.
 * @param {HTMLElement} parent  - Parent node, get sub-node from this node, default document.body
 * @returns {array} Return a node array.
 * @see {@link https://codepen.io/axui/pen/JjxNQEO|demo @ codepen}
 * @example
 * ax.getEls('#demo');
 * <!--return [node]-->
 * ax.getEls('#demo1,#demo2,#demo3');
 * <!--return [node1,node2,node3]-->
 * ax.getEls(['#demo1','#demo2,'#demo3']);
 * <!--return [node1,node2,node3]-->
 */
'use strict';
import getDataType from './getDataType';
import getEl from './getEl';
const getEls = (data, parent = document.body) => {
    let type = getDataType(data), result = [];
    if (type.includes('HTML')) {
        result.push(data);
    }
    else if (type === 'String') {
        data = data.trim();
        result = data.split(',').map((k) => {
            return getEl(k, parent);
        });
    }
    else if (type === 'Array') {
        result = data.map((k) => {
            return getEl(k, parent);
        });
    }
    return result.filter(Boolean);
};
export default getEls;
