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

fix: use own object flattening function that supports class objects #402

Merged
merged 6 commits into from
Feb 5, 2025

Conversation

Freezystem
Copy link
Contributor

@Freezystem Freezystem commented Feb 4, 2025

This PR removes the flat npm package to replace the flattening function by an homemade one that only flattens plain old javascript objects and let other structures as is.

fixes #401

@Freezystem Freezystem changed the title Use own object flattening function that supports class objects fixes#401 Use own object flattening function that supports class objects fixes #401 Feb 4, 2025
@Freezystem Freezystem changed the title Use own object flattening function that supports class objects fixes #401 fix: use own object flattening function that supports class objects Feb 4, 2025
@Freezystem Freezystem force-pushed the fix/useDotNotation-flatten-fn branch from ac63129 to 41d815b Compare February 4, 2025 10:25
@Freezystem Freezystem force-pushed the fix/useDotNotation-flatten-fn branch from 85cfa95 to 4eb9a95 Compare February 5, 2025 18:11

const { flatten } = require("../../src/utils");

if (process.versions.node.split(".")[0] < 14) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is This filter necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really. it's because node 10 and 12 does not have "crypto" lib in their core but I can remove the UUID from the test.

Copy link
Contributor Author

@Freezystem Freezystem Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't have included ObjectId in the test because I don't wanted to add the mongodb lib as a dependency just for a tiny test.
💡 But I have an idea. I'll create a tiny homemade class that mimics an ObjectId and that will be compatible with all node versions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, or you can use Date

Copy link
Member

@icebob icebob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@icebob icebob merged commit 83a336b into moleculerjs:master Feb 5, 2025
6 checks passed
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.

useDotNotation flatten ObjectIds and other Class Object
2 participants