For the one last item not under the user's control, I believe we ought to add magic for types to short-circuit our internal use of isPlainObject, e.g., so that, when special properties have been added via the likes of Object.defineProperty, a "plain" object can be treated as a special one.
This short-circuiting might be as simple as defining a boolean like isPlainObject: true on the type (this would also fit into https://github.com/dfahlander/typeson/issues/1 ) so its tester (which I think would be a bit better renamed to detector, btw, if that's ok) could ensure a match avoided the normal object cloning routine.
I think such a boolean would be superior to forcing the user to have to pass config to achieve this effect as a boolean would avoid breaking modularity.
For the one last item not under the user's control, I believe we ought to add magic for types to short-circuit our internal use of
isPlainObject
, e.g., so that, when special properties have been added via the likes ofObject.defineProperty
, a "plain" object can be treated as a special one.This short-circuiting might be as simple as defining a boolean like
isPlainObject: true
on the type (this would also fit into https://github.com/dfahlander/typeson/issues/1 ) so its tester (which I think would be a bit better renamed todetector
, btw, if that's ok) could ensure a match avoided the normal object cloning routine.I think such a boolean would be superior to forcing the user to have to pass config to achieve this effect as a boolean would avoid breaking modularity.