Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merges Files, resulting in an object with just path #53

Closed
2 tasks done
rik-iso opened this issue Dec 27, 2024 · 4 comments
Closed
2 tasks done

merges Files, resulting in an object with just path #53

rik-iso opened this issue Dec 27, 2024 · 4 comments

Comments

@rik-iso
Copy link

rik-iso commented Dec 27, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

"@fastify/deepmerge": "^2.0.1"

Plugin version

No response

Node.js version

20.x

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

15.3

Description

deepmerge considers a File a mergable object (passes isMergeableObject here), which results in a busted output (an object containing just the path field).

Similar to how that code special cases RegExp and Date, should it special case File?
If not, should there be a way for the user to provide their own function to augment/replace this if they want the behaviour I do? (which is specifically for the source file to overwrite the target File during a merge).

Link to code that reproduces the bug

No response

Expected Behavior

No response

@Uzlopak
Copy link
Contributor

Uzlopak commented Jan 8, 2025

@rik-iso

THe problem is, that File is not always defined as a global object. Maybe we should check if the type of the object is a plain object?

@rik-iso
Copy link
Author

rik-iso commented Jan 10, 2025

Sorry I don't think I follow what you mean exactly

@Uzlopak
Copy link
Contributor

Uzlopak commented Feb 6, 2025

See #68, will this fix your problem?

@Uzlopak
Copy link
Contributor

Uzlopak commented Apr 2, 2025

@rik-iso

#68 got merged. So you should be able to modify isMergeableObject as soon as the new version of deepmerge is released.
So you can pass a custom isMergeableObject and check for File Objects.

@mcollina mcollina closed this as completed Apr 2, 2025
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

No branches or pull requests

3 participants