Download src/utils/deepMerge.js from ASEM12345/anti_api: direct link, hf CLI and curl.
- Browser
- Download file 396 Bytes
-
https://huggingface.co/spaces/ASEM12345/anti_api/resolve/main/src/utils/deepMerge.js
- Command line
-
hf download hf://spaces/ASEM12345/anti_api/src/utils/deepMerge.js
-
curl -L -o deepMerge.js https://huggingface.co/spaces/ASEM12345/anti_api/resolve/main/src/utils/deepMerge.js
396 Bytes
| /** | |
| * 深度合并对象,保留未修改的字段 | |
| */ | |
| export function deepMerge(target, source) { | |
| const result = { ...target }; | |
| for (const key in source) { | |
| if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) { | |
| result[key] = deepMerge(target[key] || {}, source[key]); | |
| } else { | |
| result[key] = source[key]; | |
| } | |
| } | |
| return result; | |
| } | |