Skip to content

Doesn't confirm that the constructor is a function #26

@mostekcm

Description

@mostekcm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions