is-plain-object
is-plain-object copied to clipboard
Doesn't confirm that the constructor is a function
I have a plain JS object that is failing the check because it has an attribute called "constructor". But it is defined as a string. This should still be considered a plain JS object.
const myPlainObj = {"code":"invalid_user_password","constructor":"Object","extras":{},"message":"invalid_user_password"};
if (isPlainObject(myPlainObj)) console.log('It is Plain');
else console.log(":(");
https://github.com/jonschlinkert/is-plain-object/blob/master/is-plain-object.js#L17-L19 would likely need to change.
I can create a PR if you'd like.
Okay, I see you have specifically checking for this since pretty much the beginning, and I'm guessing because there are potentially other implications of setting a field called constructor in JSON. Feel free to close this if you'd like. In my use case where I thought I needed this, I have to ignore it anyway because it messes with something else in my framework if you do this.