Skip to content

Export private isMergeableObject #67

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

Closed
2 tasks done
benjamin-stern opened this issue Feb 6, 2025 · 2 comments · Fixed by #68
Closed
2 tasks done

Export private isMergeableObject #67

benjamin-stern opened this issue Feb 6, 2025 · 2 comments · Fixed by #68

Comments

@benjamin-stern
Copy link
Contributor

Prerequisites

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

🚀 Feature Proposal

Export the private function isMergeableObject so that it can be easily extended when adding functionality?

There is also no documentation indicating the behavior that it's being overwritten and what the base configuration is meant to do.

so instead of defining:

const customDeepMergeOptions: Options = {
    isMergeableObject: function newIsMergeableObject(value): boolean {
        // Default Logic from the Base Options it's not inheritable.
        return typeof value === 'object' && value !== null && !(value instanceof RegExp) && !(value instanceof Date)
            // Custom Overrides
            && !(value instanceof FormData);
    }
}

it can be defined like so getting any future changes to the functionality:

import deepmerge, { Options,  isMergeableObject} from "deepmerge";
const customDeepMergeOptions: Options = {
    isMergeableObject: function newIsMergeableObject(value): boolean {
        // Default Logic .
        return isMergeableObject(value) 
            // Custom Overrides
            && !(value instanceof FormData);
    }
}

Motivation

No response

Example

No response

@Uzlopak
Copy link
Contributor

Uzlopak commented Feb 6, 2025

like #68?

@benjamin-stern
Copy link
Contributor Author

benjamin-stern commented Feb 6, 2025

@Uzlopak yes, but with the ability to use the defaultIsMergeableObject to build upon if need be. So it would be awesome if it could be exported.

@Fdawgs Fdawgs linked a pull request Feb 7, 2025 that will close this issue
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 a pull request may close this issue.

2 participants