main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
904 bytes
|
Line | |
---|
1 | import copyObject from './_copyObject.js';
|
---|
2 | import createAssigner from './_createAssigner.js';
|
---|
3 | import keysIn from './keysIn.js';
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * This method is like `_.assign` except that it iterates over own and
|
---|
7 | * inherited source properties.
|
---|
8 | *
|
---|
9 | * **Note:** This method mutates `object`.
|
---|
10 | *
|
---|
11 | * @static
|
---|
12 | * @memberOf _
|
---|
13 | * @since 4.0.0
|
---|
14 | * @alias extend
|
---|
15 | * @category Object
|
---|
16 | * @param {Object} object The destination object.
|
---|
17 | * @param {...Object} [sources] The source objects.
|
---|
18 | * @returns {Object} Returns `object`.
|
---|
19 | * @see _.assign
|
---|
20 | * @example
|
---|
21 | *
|
---|
22 | * function Foo() {
|
---|
23 | * this.a = 1;
|
---|
24 | * }
|
---|
25 | *
|
---|
26 | * function Bar() {
|
---|
27 | * this.c = 3;
|
---|
28 | * }
|
---|
29 | *
|
---|
30 | * Foo.prototype.b = 2;
|
---|
31 | * Bar.prototype.d = 4;
|
---|
32 | *
|
---|
33 | * _.assignIn({ 'a': 0 }, new Foo, new Bar);
|
---|
34 | * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
|
---|
35 | */
|
---|
36 | var assignIn = createAssigner(function(object, source) {
|
---|
37 | copyObject(source, keysIn(source), object);
|
---|
38 | });
|
---|
39 |
|
---|
40 | export default assignIn;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.