Skip to content

✨ Quality: Fix serialization of native functions like Number, String#214

Open
hieuit095 wants to merge 1 commit intoyahoo:mainfrom
hieuit095:contribai/improve/quality/fix-serialization-of-native-functions-li
Open

✨ Quality: Fix serialization of native functions like Number, String#214
hieuit095 wants to merge 1 commit intoyahoo:mainfrom
hieuit095:contribai/improve/quality/fix-serialization-of-native-functions-li

Conversation

@hieuit095
Copy link
Copy Markdown

Problem

The issue is that serialize-javascript throws a TypeError when trying to serialize native functions (like Number, String, Array, etc.). The fix should detect native built-in constructors and serialize them by their name (e.g., Number instead of throwing an error).

Severity: medium
File: index.js

Solution

The issue is that serialize-javascript throws a TypeError when trying to serialize native functions (like Number, String, Array, etc.). The fix should detect native built-in constructors and serialize them by their name (e.g., Number instead of throwing an error).

Changes

  • index.js (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

Closes #179

The issue is that serialize-javascript throws a TypeError when trying to serialize native functions (like `Number`, `String`, `Array`, etc.). The fix should detect native built-in constructors and serialize them by their name (e.g., `Number` instead of throwing an error).

Affected files: index.js

Signed-off-by: hieuit095 <139037144+hieuit095@users.noreply.github.com>
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.

Fails on native functions, like Number or String (SOLUTION INCLUDED)

1 participant