/**
 * @since Last modified: 2024/05/29 09:04:10
 * @function getHtmlCode
 * @description Gets a array value from a node attribute.
 * @param {string} value  - The value obtained through the "getAttribute" method.
 * @param {string} [default='']  - The value obtained through the "getAttribute" method.
 * @returns {array} Return a array value.
 * @see {@link https://codepen.io/axui/pen/ZENBYNL|demo @ codepen}
 * @example
 * ax.getHtmlCode('true');
 * <!--return []-->
 * ax.getHtmlCode('true','close');
 * <!--return ['close']-->
 * ax.getHtmlCode(null);
 * <!--return []-->
 * ax.getHtmlCode('','close');
 * <!--return ['close']-->
* ax.getHtmlCode('close,toggle');
 * <!--return ['close','toggle']-->
 * ax.getHtmlCode('['toggle']','close');
 * <!--return ['toggle']-->
 */




'use strict';
const getHtmlCode = (val: string): any => {
    
    
    let result: any[] = [];
    if (val !== null) {
        let tmp = val.trim();
        try {
            if (tmp === '' || tmp === 'true') {
                
                result = dft.split(',').filter(Boolean);
            } else {
                result = new Function('return ' + tmp)();
            }
        } catch (err) {
            
            console.warn('The parsing failed, and the array has already been output using the split method!');
            result = tmp.split(',');
        }
    } 
    return result;
}
export default getHtmlCode;
