deep-map-keys icon indicating copy to clipboard operation
deep-map-keys copied to clipboard

Customize whether an object gets transformed

Open mcmath opened this issue 6 years ago • 3 comments

Currently, the keys of every non-primitive object are transformed recursively. In some cases, users may not want transform certain objects, such as Date objects (see issue #7). There should be a way for users to customize whether an object gets transformed based on a predicate function they may pass in. By default, objects such as Dates probably shouldn't be transformed.

mcmath avatar Jan 29 '19 03:01 mcmath

I opened a PR for this feature. We were seeing a similar issue with Date objects losing their type. I chose to not introduce a default value to prevent breaking changes to the library.

A good default would probably be to avoid transforming any of the global Javascript object types. However, that might be better as built-in behavior, separate from this option, in order to prevent a user from accidentally overriding it.

atlas-ssallay avatar Apr 06 '19 03:04 atlas-ssallay

Hi, I've experienced the same issue, is there any news with the feature? @atlas-ssallay

sitvanit avatar Jan 06 '20 11:01 sitvanit

Would be very nice to see that feature released. Currently the transformation breaks any file objects in formData.

odragora avatar Jul 15 '21 18:07 odragora