1 var baseAssign = require('../internal/baseAssign'),
2 baseCreate = require('../internal/baseCreate'),
3 isIterateeCall = require('../internal/isIterateeCall');
6 * Creates an object that inherits from the given `prototype` object. If a
7 * `properties` object is provided its own enumerable properties are assigned
8 * to the created object.
13 * @param {Object} prototype The object to inherit from.
14 * @param {Object} [properties] The properties to assign to the object.
15 * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
16 * @returns {Object} Returns the new object.
28 * Circle.prototype = _.create(Shape.prototype, {
29 * 'constructor': Circle
32 * var circle = new Circle;
33 * circle instanceof Circle;
36 * circle instanceof Shape;
39 function create(prototype, properties, guard) {
40 var result = baseCreate(prototype);
41 if (guard && isIterateeCall(prototype, properties, guard)) {
42 properties = undefined;
44 return properties ? baseAssign(result, properties) : result;
47 module.exports = create;