Starcounter-Jack / JSON-Patch

Lean and mean Javascript implementation of the JSON-Patch standard (RFC 6902). Update JSON documents using delta patches.
MIT License
1.78k stars 215 forks source link

Add user-defined hooks into the deepClone function #281

Open udbhav-s opened 2 years ago

udbhav-s commented 2 years ago

I'm using fast-json-patch with an object where I need to remove some private properties on the server before generating the patch and sending it to the client - adding a hook for the clone function would allow people to transform the object before patches are generated, which would remove the need for redundantly deep cloning the object and then passing it into jsonpatch. Users could also use this hook to handle edge cases like Dates and other objects which cannot be directly converted into JSON.