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

why not provide deep copy method,be like deep copy of array or object? #384

Open
yyqxjwxy opened this issue Mar 13, 2024 · 5 comments
Open

Comments

@yyqxjwxy
Copy link

No description provided.

@shtse8
Copy link

shtse8 commented Mar 14, 2024

Deep cloning objects and arrays can indeed get quite complex, especially when you consider all the potential edge cases like nested structures and special types (like Date, RegExp). The aim of Radash is to keep things simple and efficient, focusing on the most common use cases.

Adding a deep copy feature would significantly increase the complexity and size of the library. That’s why it’s left out, allowing users to integrate or implement their own solutions for specific needs. There are dedicated libraries out there that handle deep cloning well, which might be worth looking into for more complex requirements.

I hope this makes sense and aligns with your expectations for using Radash.

@qingzhoufeihu
Copy link

Now the packaging tools all have tree shaking functions, if the developer does not reference the deep copy function, it will not be packaged into the final bundle, so there is no need to consider the package size.

@troy351
Copy link

troy351 commented Mar 19, 2024

Maybe structuredClone ?

@qingzhoufeihu
Copy link

We could use immer instead

@Gemini-0529
Copy link

Now the packaging tools all have tree shaking functions, if the developer does not reference the deep copy function, it will not be packaged into the final bundle, so there is no need to consider the package size.

日常需求感觉JSON.parse JSON.stringify就够了

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

5 participants