(
destination: Record<string, unknown>,
source: Record<string, unknown>,
overridableKeys: Set<string>,
)
| 428 | if (detected) return { tag, anchor, kind: "sequence", result }; |
| 429 | } |
| 430 | mergeMappings( |
| 431 | destination: Record<string, unknown>, |
| 432 | source: Record<string, unknown>, |
| 433 | overridableKeys: Set<string>, |
| 434 | ) { |
| 435 | if (!isObject(source)) { |
| 436 | throw this.#createError( |
| 437 | "Cannot merge mappings: the provided source object is unacceptable", |
| 438 | ); |
| 439 | } |
| 440 | |
| 441 | for (const [key, value] of Object.entries(source)) { |
| 442 | if (Object.hasOwn(destination, key)) continue; |
| 443 | // `Object.defineProperty` is significantly slower than direct |
| 444 | // assignment in V8. Direct assignment produces an identical descriptor |
| 445 | // (writable/enumerable/configurable) for ordinary keys; the only |
| 446 | // sensitive case is `__proto__`, where direct assignment would mutate |
| 447 | // the prototype chain instead of creating an own property. |
| 448 | if (key === "__proto__") { |
| 449 | Object.defineProperty(destination, key, { |
| 450 | value, |
| 451 | writable: true, |
| 452 | enumerable: true, |
| 453 | configurable: true, |
| 454 | }); |
| 455 | } else { |
| 456 | destination[key] = value; |
| 457 | } |
| 458 | overridableKeys.add(key); |
| 459 | } |
| 460 | } |
| 461 | storeMappingPair( |
| 462 | result: Record<string, unknown>, |
| 463 | overridableKeys: Set<string>, |
no test coverage detected