mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-10-13 18:22:13 +08:00
14 lines
422 B
TypeScript
14 lines
422 B
TypeScript
import { deepmerge, lodash } from '@fesjs/utils';
|
|
|
|
interface MergeDefaultOptions {
|
|
defaultConfig: any;
|
|
config: any;
|
|
}
|
|
|
|
export default function mergeDefault({ defaultConfig, config }: MergeDefaultOptions): any {
|
|
if (lodash.isPlainObject(defaultConfig) && lodash.isPlainObject(config)) {
|
|
return deepmerge(defaultConfig, config);
|
|
}
|
|
return typeof config !== 'undefined' ? config : defaultConfig;
|
|
}
|