main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
850 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
---|
4 |
|
---|
5 | /*!
|
---|
6 | * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
---|
7 | *
|
---|
8 | * Copyright (c) 2014-2017, Jon Schlinkert.
|
---|
9 | * Released under the MIT License.
|
---|
10 | */
|
---|
11 |
|
---|
12 | function isObject(o) {
|
---|
13 | return Object.prototype.toString.call(o) === '[object Object]';
|
---|
14 | }
|
---|
15 |
|
---|
16 | function isPlainObject(o) {
|
---|
17 | var ctor,prot;
|
---|
18 |
|
---|
19 | if (isObject(o) === false) return false;
|
---|
20 |
|
---|
21 | // If has modified constructor
|
---|
22 | ctor = o.constructor;
|
---|
23 | if (ctor === undefined) return true;
|
---|
24 |
|
---|
25 | // If has modified prototype
|
---|
26 | prot = ctor.prototype;
|
---|
27 | if (isObject(prot) === false) return false;
|
---|
28 |
|
---|
29 | // If constructor does not have an Object-specific method
|
---|
30 | if (prot.hasOwnProperty('isPrototypeOf') === false) {
|
---|
31 | return false;
|
---|
32 | }
|
---|
33 |
|
---|
34 | // Most likely a plain Object
|
---|
35 | return true;
|
---|
36 | }
|
---|
37 |
|
---|
38 | exports.isPlainObject = isPlainObject;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.