mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2026-09-04 15:04:26 +08:00
15 lines
451 B
TypeScript
15 lines
451 B
TypeScript
import { deepmerge } from '@fesjs/utils';
|
|
import { isPlainObject } from 'es-toolkit/compat';
|
|
|
|
interface MergeDefaultOptions {
|
|
defaultConfig: any;
|
|
config: any;
|
|
}
|
|
|
|
export default function mergeDefault({ defaultConfig, config }: MergeDefaultOptions): any {
|
|
if (isPlainObject(defaultConfig) && isPlainObject(config)) {
|
|
return deepmerge(defaultConfig, config);
|
|
}
|
|
return typeof config !== 'undefined' ? config : defaultConfig;
|
|
}
|