post 请求不能传数组,把数组变成了对象

时间:2025-01-15 07:05:51
export const merge = function(){ var result = {}; Array.from(arguments).forEach( e =>{ for(let key in e){ if( typeof e[key] === 'object' && !isEmptyObject(e[key]) && !(e[key] instanceof Array)){ merge( result[key] , e[key] ) } result[key] = e[key] } }); return result; } export const deepMerge = function () { let result = {}; Array.from(arguments).forEach(e =>{ if( e && typeof e === 'object' && !isEmptyObject(e) ) { Object.keys(e).forEach( key => { if( typeof e[key] === 'object' && !(e[key] instanceof Array)){ return result[key] = deepMerge( result[key] , e[key] ) } result[key] = e[key] }); } }) return result ; }