create.js 658 B

12345678910111213141516171819202122
  1. 'use strict';
  2. var setPrototypeOf = require('../../object/set-prototype-of')
  3. , getPrototypeOf = Object.getPrototypeOf;
  4. module.exports = function (t, a) {
  5. var x = {}, obj;
  6. a(getPrototypeOf(t(x)), x, "Normal object");
  7. a(getPrototypeOf(t(null)),
  8. (setPrototypeOf && setPrototypeOf.nullPolyfill) || null, "Null");
  9. a.h1("Properties");
  10. a.h2("Normal object");
  11. a(getPrototypeOf(obj = t(x, { foo: { value: 'bar' } })), x, "Prototype");
  12. a(obj.foo, 'bar', "Property");
  13. a.h2("Null");
  14. a(getPrototypeOf(obj = t(null, { foo: { value: 'bar2' } })),
  15. (setPrototypeOf && setPrototypeOf.nullPolyfill) || null, "Prototype");
  16. a(obj.foo, 'bar2', "Property");
  17. };