Skip to content

Add handling for Temporal types#55

Open
cn-stephen wants to merge 1 commit intoAsyncBanana:masterfrom
cn-stephen:temporal-support
Open

Add handling for Temporal types#55
cn-stephen wants to merge 1 commit intoAsyncBanana:masterfrom
cn-stephen:temporal-support

Conversation

@cn-stephen
Copy link
Copy Markdown

Temporal types throw on valueOf/Symbol.toPrimitive, so the existing coercion-based comparison breaks. Detect them by constructor name and compare via String() instead.

  • Rename objKey/newObjKey to value/newValue for clarity
  • Add temporalTypes lookup for all 8 Temporal types
  • Gate Object.getPrototypeOf behind areCompatibleObjects for perf
  • Guard against null values in objConstructor computation
  • Use early-exit continue pattern for clearer control flow
  • Add richTypes guard to coercion comparison for explicitness
  • Add tests for all Temporal types including cross-type replacement
  • Add regression test for null-to-object replacement

Temporal types throw on valueOf/Symbol.toPrimitive, so the existing
coercion-based comparison breaks. Detect them by constructor name and
compare via String() instead.

- Rename objKey/newObjKey to value/newValue for clarity
- Add temporalTypes lookup for all 8 Temporal types
- Gate Object.getPrototypeOf behind areCompatibleObjects for perf
- Guard against null values in objConstructor computation
- Use early-exit continue pattern for clearer control flow
- Add richTypes guard to coercion comparison for explicitness
- Add tests for all Temporal types including cross-type replacement
- Add regression test for null-to-object replacement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant