mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Make it clearer that extend and defaults modify in place *and* return
This commit is contained in:
@@ -1005,8 +1005,9 @@ _.functions(_);
|
|||||||
<b class="header">extend</b><code>_.extend(destination, *sources)</code>
|
<b class="header">extend</b><code>_.extend(destination, *sources)</code>
|
||||||
<br />
|
<br />
|
||||||
Copy all of the properties in the <b>source</b> objects over to the
|
Copy all of the properties in the <b>source</b> objects over to the
|
||||||
<b>destination</b> object. It's in-order, so the last source will override
|
<b>destination</b> object, and return the <b>destination</b> object.
|
||||||
properties of the same name in previous arguments.
|
It's in-order, so the last source will override properties of the same
|
||||||
|
name in previous arguments.
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
_.extend({name : 'moe'}, {age : 50});
|
_.extend({name : 'moe'}, {age : 50});
|
||||||
@@ -1017,8 +1018,8 @@ _.extend({name : 'moe'}, {age : 50});
|
|||||||
<b class="header">defaults</b><code>_.defaults(object, *defaults)</code>
|
<b class="header">defaults</b><code>_.defaults(object, *defaults)</code>
|
||||||
<br />
|
<br />
|
||||||
Fill in missing properties in <b>object</b> with default values from the
|
Fill in missing properties in <b>object</b> with default values from the
|
||||||
<b>defaults</b> objects. As soon as the property is filled, further defaults
|
<b>defaults</b> objects, and return the <b>object</b>. As soon as the
|
||||||
will have no effect.
|
property is filled, further defaults will have no effect.
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
var iceCream = {flavor : "chocolate"};
|
var iceCream = {flavor : "chocolate"};
|
||||||
|
|||||||
Reference in New Issue
Block a user