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
fix: support Objects created with Object.create({}) #842
Changes from 2 commits
10d5d0c
ce5ef69
f0c4554
de0ca29
ea4471e
5db813b
45cd0ef
f320614
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1073,7 +1073,7 @@ describe('getAll() method', () => { | |
expect(actualErrorAttempts).to.deep.eq(expectedErrorAttempts); | ||
}); | ||
}); | ||
}); | ||
}).timeout(5000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is in master now, so the diff should eventually disappear: https://github.com/googleapis/nodejs-firestore/blob/master/dev/test/index.ts#L1103 |
||
|
||
it('requires at least one argument', () => { | ||
return createInstance().then(firestore => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to this stackoverflow post,
obj.constructor
can be changed by the user, so they recommend usinginstanceof
instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, the recommendation here does not quite work for us. We don't have access to the user's type and
instanceof Object
returns true for custom types as well as plain objects such as{}
.It also looks like the other suggestion
Object.prototype.toString.call
just returns[object Object]
for custom types, so that is likely out of the question too.