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

Stripping dates

Open drewmutt opened this issue 6 years ago • 2 comments

The library appears to strip dates from the values of the object.

let thing = {time:new Date()}; let transformed = deepMapKeys(thing, item=>item); console.log(thing); console.log(transformed);

The "time" value comes back blank.

drewmutt avatar Jan 28 '19 20:01 drewmutt

The reason is because Date is not a primitive, so it tries to go through the values of the Date and transform its keys. This is probably not the behavior most users expect. I'm going to add a feature that allows users to customize whether or not an object gets transformed. I'll probably also change the default behavior so that Date does not get transformed.

Thanks for raising the issue.

mcmath avatar Jan 29 '19 03:01 mcmath

ETA?

romgrk avatar Feb 10 '20 21:02 romgrk