/**
 * @since Last modified: 2024/06/10 17:57:04
 * @function extend
 * @description Extend the object. Increase the key value pair of objects.It is an enhancement to the util assign.
 * @param {Object} options  - The parameters.
 * @param {Object} options.target  - The original target of the merged.
 * @param {Object} [options.source]  - Active merger object.
 * @param {getEl} [options.host]  - Target node or node selector, please refer to the util : getEl.
 * @param {string} [options.attr]  - an attribute on target node.
 * @returns {Object} - Return the merge object.
 * @see {@link https://codepen.io/axui/pen/mdvwJOw|demo @ codepen}
 * @example
 * let x ={a:'man',b:0,c:[]},b={a:'woman',b:2};
 * ax.extend({target:x,source:y});
 * <!--return {a:'woman',b:2,c:[]}-->
 */
'use strict';
import getEl from './getEl';
import deepMerge from './deepMerge';
import getDataType from './getDataType';
import attrToJson from './attrToJson';
const extend = ({ target = {}, source = {}, host = null, attr = '' }) => {
    let targetType = getDataType(target), el = getEl(host);
    if (targetType !== 'Object') {
        return target;
    }
    else {
        source && deepMerge(target, source);
        el && attr && deepMerge(target, attrToJson(el, attr));
    }
    return target;
};
export default extend;
