is-plain-object.js 850 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. /*!
  4. * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
  5. *
  6. * Copyright (c) 2014-2017, Jon Schlinkert.
  7. * Released under the MIT License.
  8. */
  9. function isObject(o) {
  10. return Object.prototype.toString.call(o) === '[object Object]';
  11. }
  12. function isPlainObject(o) {
  13. var ctor,prot;
  14. if (isObject(o) === false) return false;
  15. // If has modified constructor
  16. ctor = o.constructor;
  17. if (ctor === undefined) return true;
  18. // If has modified prototype
  19. prot = ctor.prototype;
  20. if (isObject(prot) === false) return false;
  21. // If constructor does not have an Object-specific method
  22. if (prot.hasOwnProperty('isPrototypeOf') === false) {
  23. return false;
  24. }
  25. // Most likely a plain Object
  26. return true;
  27. }
  28. exports.isPlainObject = isPlainObject;