/**
 * @since Last modified: 2024-08-18 19:05:37
 * @function stdParam
 * @description Convert shorthand parameters to standard object parameters.
 * @param {any} val  - Original parameter value.
 * @param {object} dft={}  - Standard default parameters of object type.
 * @param {string} [prop]  - If the original parameter value is not of object type, it should be the value of a specific property of the default parameters, and `prop` refers to that property.
 * @returns {Object} - Return a object parameters.
 * @see {@link https://codepen.io/axui/pen/QWXQNLa|demo @ codepen}
 * @example
 * ax.stdParam(null,{a:0});
 * <!--return {a:0}-->
 */
'use strict';
import { T_obj } from "../../../types/ax";
import extend from "./extend";
import getDataType from "./getDataType";
import isNull from "./isNull";
const stdParam = (val: any, dft: T_obj = {}, prop?: string) => {
    let result = (getDataType(dft) === 'Object') ? { ...dft } : {};
    if (getDataType(val) === 'Object') {
        extend({
            target: result,
            source: val,
        });
    } else {
        if(prop && !isNull(val)){
            Reflect.set(result, prop, val);
        }
    }
    return result;
}
export default stdParam;
