Skip to content

Commit a56cbaf

Browse files
saranrapjsschmidt-sebastian
authored andcommitted
Allow storing Object.create(null) in Firestore (#827)
Fixes #811
1 parent fbd5bd6 commit a56cbaf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/firestore/src/util/input_validation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,14 @@ function validateType(
282282
}
283283

284284
/**
285-
* Returns true iff it's a non-null object without a custom prototype
285+
* Returns true if it's a non-null object without a custom prototype
286286
* (i.e. excludes Array, Date, etc.).
287287
*/
288288
export function isPlainObject(input: AnyJs): boolean {
289289
return (
290290
typeof input === 'object' &&
291291
input !== null &&
292-
Object.getPrototypeOf(input) === Object.prototype
292+
(Object.getPrototypeOf(input) === Object.prototype || Object.getPrototypeOf(input) === null)
293293
);
294294
}
295295

0 commit comments

Comments
 (0)