Geen omschrijving

index.js 856B

12345678910111213141516171819202122232425262728293031323334353637
  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. 'use strict';
  8. var isObject = require('isobject');
  9. function isObjectObject(o) {
  10. return isObject(o) === true
  11. && Object.prototype.toString.call(o) === '[object Object]';
  12. }
  13. module.exports = function isPlainObject(o) {
  14. var ctor,prot;
  15. if (isObjectObject(o) === false) return false;
  16. // If has modified constructor
  17. ctor = o.constructor;
  18. if (typeof ctor !== 'function') return false;
  19. // If has modified prototype
  20. prot = ctor.prototype;
  21. if (isObjectObject(prot) === false) return false;
  22. // If constructor does not have an Object-specific method
  23. if (prot.hasOwnProperty('isPrototypeOf') === false) {
  24. return false;
  25. }
  26. // Most likely a plain Object
  27. return true;
  28. };