File tree Expand file tree Collapse file tree 1 file changed +3
-33
lines changed Expand file tree Collapse file tree 1 file changed +3
-33
lines changed Original file line number Diff line number Diff line change 1
1
/*!
2
- * is-plain-object <https://github .com/jonschlinkert/is-plain-object >
2
+ * isPlainObject <https://stackoverflow .com/questions/18531624/isplainobject-thing >
3
3
*
4
- * Copyright (c) 2014-2017, Jon Schlinkert.
5
- * Released under the MIT License.
4
+ * Copyright https://stackoverflow.com/users/6023279/trunow.
6
5
*/
7
6
8
- function isObject ( o ) {
9
- return Object . prototype . toString . call ( o ) === '[object Object]'
10
- }
11
-
12
7
export default function isPlainObject ( o ) {
13
- let ctor , prot
14
-
15
- if ( isObject ( o ) === false ) {
16
- return false
17
- }
18
-
19
- // If has modified constructor
20
- ctor = o . constructor
21
- if ( ctor === undefined ) {
22
- return true
23
- }
24
-
25
- // If has modified prototype
26
- prot = ctor . prototype
27
- if ( isObject ( prot ) === false ) {
28
- return false
29
- }
30
-
31
- // If constructor does not have an Object-specific method
32
- // eslint-disable-next-line no-prototype-builtins
33
- if ( prot . hasOwnProperty ( 'isPrototypeOf' ) === false ) {
34
- return false
35
- }
36
-
37
- // Most likely a plain Object
38
- return true
8
+ return o ?. constructor === Object || Object . getPrototypeOf ( o ?? 0 ) === null
39
9
}
You can’t perform that action at this time.
0 commit comments