Can't use `constructor` key in the object
Rigidoont opened this issue · comments
Presence of the constructor
key in the object seems to break flattening. No errors are produced, the object simply does not get flattened.
@Gidoont it might be a reserved keyword for JS to know how an object was made, as a plain object or as a class instance.
I'd advice you to not use the key called constructor
but if you must then..... I'm not sure how to fix it yet :P PRs welcome though!
Unfortunately, it's not up to me whether to use such key or not. I'm receiving a JSON and have to do some work on it.
@mesqueeb I think here's the issue - https://github.com/mesqueeb/is-what/blob/production/src/index.ts#L46
isPlainObject
method is used in https://github.com/mesqueeb/flatten-anything/blob/production/src/index.ts#L11
It does not recognize the object as a plain one if the constructor
property is overridden.
PR - mesqueeb/is-what#24
@Gidoont thank you very much! it's released in latest version v3.0.3