Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node REPL produces false value for obj instanceof Object #3

Closed
netpedro-com opened this issue Jan 12, 2017 · 4 comments
Closed

Node REPL produces false value for obj instanceof Object #3

netpedro-com opened this issue Jan 12, 2017 · 4 comments

Comments

@netpedro-com
Copy link

An Object literal passed through Node REPL isn't equal to the module context. That is, an obj passed though Node REPL produces false into this line of code obj instanceof Object. I find out this after 2 hours stuck into this. To know more about see: In REPL, required modules have different Object than command-line

Please, change obj instanceof Object to typeof obj === 'object' && obj !== null. Thanks.

@fiznool
Copy link
Owner

fiznool commented Jan 12, 2017

Thanks for the issue report. Could you provide a code snippet which reproduces the issue?

@fiznool
Copy link
Owner

fiznool commented Jan 12, 2017

I've just published v1.3.1 to npm which includes a more robust check for an object, inspired by your code snippet above. Can you check if the issue still exists with this version?

@netpedro-com
Copy link
Author

Your commit doesn't solved this issue, I'm still having false negative errors. I just made a PR that fix it. Is necessary a more robust solution to check for isPlainObject function?

@fiznool
Copy link
Owner

fiznool commented Jan 12, 2017

Thanks, fixed and published as v1.3.2.

@fiznool fiznool closed this as completed Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants