We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 07d4a0a commit 0a6b897Copy full SHA for 0a6b897
packages/shared/src/utils.ts
@@ -151,8 +151,11 @@ export const objectToString = Object.prototype.toString
151
export const toTypeString = (value: unknown): string =>
152
objectToString.call(value)
153
154
-export const isPlainObject = (val: unknown): val is object =>
155
- toTypeString(val) === '[object Object]'
+export const isPlainObject = (val: unknown): val is object => {
+ if (!isObject(val)) return false
156
+ const proto = Object.getPrototypeOf(val)
157
+ return proto === null || proto.constructor === Object
158
+}
159
160
// for converting list and named values to displayed strings.
161
export const toDisplayString = (val: unknown): string => {
0 commit comments