index.cjs.js 1.1 KB

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