is-plain-object.js 789 B

123456789101112131415161718
  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(t({ prototype: 1, constructor: 2, __proto__: 3 }), true,
  6. "{} with any property keys is plain object");
  7. a(t(null), false, "Null is not plain object");
  8. a(t('string'), false, "Primitive is not plain object");
  9. a(t(function () {}), false, "Function is not plain object");
  10. a(t(Object.create({})), false,
  11. "Object whose prototype is not Object.prototype is not plain object");
  12. a(t(Object.create(Object.prototype)), true,
  13. "Object whose prototype is Object.prototype is plain object");
  14. a(t(Object.create(null)), true,
  15. "Object whose prototype is null is plain object");
  16. a(t(Object.prototype), false, "Object.prototype");
  17. };