baseCreate.js 559 B

1234567891011121314151617181920212223
  1. import isObject from '../isObject';
  2. /**
  3. * The base implementation of `_.create` without support for assigning
  4. * properties to the created object.
  5. *
  6. * @private
  7. * @param {Object} prototype The object to inherit from.
  8. * @returns {Object} Returns the new object.
  9. */
  10. var baseCreate = (function() {
  11. function object() {}
  12. return function(prototype) {
  13. if (isObject(prototype)) {
  14. object.prototype = prototype;
  15. var result = new object;
  16. object.prototype = undefined;
  17. }
  18. return result || {};
  19. };
  20. }());
  21. export default baseCreate;