source: trip-planner-front/node_modules/is-plain-object/index.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 856 bytes
Line 
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
8'use strict';
9
10var isObject = require('isobject');
11
12function isObjectObject(o) {
13 return isObject(o) === true
14 && Object.prototype.toString.call(o) === '[object Object]';
15}
16
17module.exports = function isPlainObject(o) {
18 var ctor,prot;
19
20 if (isObjectObject(o) === false) return false;
21
22 // If has modified constructor
23 ctor = o.constructor;
24 if (typeof ctor !== 'function') return false;
25
26 // If has modified prototype
27 prot = ctor.prototype;
28 if (isObjectObject(prot) === false) return false;
29
30 // If constructor does not have an Object-specific method
31 if (prot.hasOwnProperty('isPrototypeOf') === false) {
32 return false;
33 }
34
35 // Most likely a plain Object
36 return true;
37};
Note: See TracBrowser for help on using the repository browser.