(base: any, source: any)
| 510 | }; |
| 511 | |
| 512 | const deepMerge = (base: any, source: any) => { |
| 513 | // Check if either base or source is not an object, or if source is null |
| 514 | if ( |
| 515 | typeof base !== "object" || |
| 516 | typeof source !== "object" || |
| 517 | source === null |
| 518 | ) { |
| 519 | return source; |
| 520 | } |
| 521 | |
| 522 | // Create a copy of the base object to avoid modifying it directly |
| 523 | const merged = { ...base }; |
| 524 | |
| 525 | // Loop through all properties in the source object |
| 526 | for (const key in source) { |
| 527 | if (source.hasOwnProperty(key)) { |
| 528 | // If the key exists in the base object and both values are objects, merge recursively |
| 529 | if ( |
| 530 | base.hasOwnProperty(key) && |
| 531 | typeof base[key] === "object" && |
| 532 | typeof source[key] === "object" |
| 533 | ) { |
| 534 | merged[key] = deepMerge(base[key], source[key]); |
| 535 | } else { |
| 536 | // If the key does not exist in the base object or one of the values is not an object, assign the source value to the merged object |
| 537 | merged[key] = source[key]; |
| 538 | } |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | return merged; |
| 543 | }; |
| 544 | |
| 545 | const normalizeSwaggerPath = (path: string) => { |
| 546 | return path.replaceAll(/:([^/]+)/g, "{$1}"); |
no outgoing calls
no test coverage detected