Commit b6fb5f3
committed
fix(NODE-5937): restore non-string Map key guard in serializer
Commit a22387a dropped the `typeof key === 'string'` guard from the key
validation block on the assumption that keys are always strings. That holds
for plain objects and arrays, but Map keys can be non-string. Without the
guard, a non-string Map key with checkKeys:true reached `key.includes('.')`
and threw a TypeError from a different site than the baseline.
Restoring the guard makes behavior byte-identical to the pre-regression
implementation: non-string Map keys (unsupported by design, NODE-3027) fail
in encodeUTF8Into exactly as before, regardless of checkKeys. The Set lookup
optimization is unaffected — it remains gated by `key[0] === '$'`.1 parent b0e9960 commit b6fb5f3
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
590 | | - | |
| 590 | + | |
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
| |||
0 commit comments