is-plain-object.js 801 B

1234567891011121314151617181920212223
  1. "use strict";
  2. module.exports = function (t, a) {
  3. a(t({}), true, "Empty {} is plain object");
  4. a(t({ a: true }), true, "{} with property is plain object");
  5. a(
  6. t({ prototype: 1, constructor: 2, __proto__: 3 }), true,
  7. "{} with any property keys is plain object"
  8. );
  9. a(t(null), false, "Null is not plain object");
  10. a(t("string"), false, "Primitive is not plain object");
  11. a(t(function () {}), false, "Function is not plain object");
  12. a(
  13. t(Object.create({})), false,
  14. "Object whose prototype is not Object.prototype is not plain object"
  15. );
  16. a(
  17. t(Object.create(Object.prototype)), true,
  18. "Object whose prototype is Object.prototype is plain object"
  19. );
  20. a(t(Object.create(null)), true, "Object whose prototype is null is plain object");
  21. a(t(Object.prototype), false, "Object.prototype");
  22. };