source: trip-planner-front/node_modules/lodash/create.js@ 6fe77af

Last change on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1var baseAssign = require('./_baseAssign'),
2 baseCreate = require('./_baseCreate');
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
43module.exports = create;
Note: See TracBrowser for help on using the repository browser.