is-plain-object.js 861 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.getObjectClassLabel = getObjectClassLabel;
  6. exports.isPlainObject = isPlainObject;
  7. function getObjectClassLabel(value) {
  8. return Object.prototype.toString.call(value);
  9. }
  10. function isPlainObject(value) {
  11. if (getObjectClassLabel(value) !== '[object Object]') {
  12. return false;
  13. }
  14. const prototype = Object.getPrototypeOf(value);
  15. /**
  16. * this used to be previously:
  17. *
  18. * `return prototype === null || prototype === Object.prototype`
  19. *
  20. * but Edge Runtime expose Object from vm, being that kind of type-checking wrongly fail.
  21. *
  22. * It was changed to the current implementation since it's resilient to serialization.
  23. */ return prototype === null || prototype.hasOwnProperty('isPrototypeOf');
  24. }
  25. //# sourceMappingURL=is-plain-object.js.map