source: imaps-frontend/node_modules/lodash-es/create.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[d565449]1import baseAssign from './_baseAssign.js';
2import baseCreate from './_baseCreate.js';
3
4/**
5 * Creates an object that inherits from the `prototype` object. If a
6 * `properties` object is given, its own enumerable string keyed properties
7 * are assigned to the created object.
8 *
9 * @static
10 * @memberOf _
11 * @since 2.3.0
12 * @category Object
13 * @param {Object} prototype The object to inherit from.
14 * @param {Object} [properties] The properties to assign to the object.
15 * @returns {Object} Returns the new object.
16 * @example
17 *
18 * function Shape() {
19 * this.x = 0;
20 * this.y = 0;
21 * }
22 *
23 * function Circle() {
24 * Shape.call(this);
25 * }
26 *
27 * Circle.prototype = _.create(Shape.prototype, {
28 * 'constructor': Circle
29 * });
30 *
31 * var circle = new Circle;
32 * circle instanceof Circle;
33 * // => true
34 *
35 * circle instanceof Shape;
36 * // => true
37 */
38function create(prototype, properties) {
39 var result = baseCreate(prototype);
40 return properties == null ? result : baseAssign(result, properties);
41}
42
43export default create;
Note: See TracBrowser for help on using the repository browser.