source: node_modules/is-plain-object/dist/is-plain-object.mjs@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 758 bytes
RevLine 
[d24f17c]1/*!
2 * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
3 *
4 * Copyright (c) 2014-2017, Jon Schlinkert.
5 * Released under the MIT License.
6 */
7
8function isObject(o) {
9 return Object.prototype.toString.call(o) === '[object Object]';
10}
11
12function isPlainObject(o) {
13 var ctor,prot;
14
15 if (isObject(o) === false) return false;
16
17 // If has modified constructor
18 ctor = o.constructor;
19 if (ctor === undefined) return true;
20
21 // If has modified prototype
22 prot = ctor.prototype;
23 if (isObject(prot) === false) return false;
24
25 // If constructor does not have an Object-specific method
26 if (prot.hasOwnProperty('isPrototypeOf') === false) {
27 return false;
28 }
29
30 // Most likely a plain Object
31 return true;
32}
33
34export { isPlainObject };
Note: See TracBrowser for help on using the repository browser.