Skip to content

Commit b5f481a

Browse files
committed
documentation
1 parent 7c6c6a1 commit b5f481a

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@
392392
<li data-name="toPath">- <a href="#toPath">toPath</a></li>
393393
<li data-name="has">- <a href="#has">has</a></li>
394394
<li data-name="get">- <a href="#get">get</a></li>
395+
<li data-name="set">- <a href="#set">set</a></li>
395396
<li data-name="property">- <a href="#property">property</a></li>
396397
<li data-name="propertyOf">- <a href="#propertyOf">propertyOf</a></li>
397398
<li data-name="matcher">- <a href="#matcher">matcher</a></li>
@@ -1951,6 +1952,20 @@ <h2 id="objects">Object Functions</h2>
19511952
=&gt; 2
19521953
_.get({a: 10}, 'b', 100);
19531954
=&gt; 100
1955+
</pre>
1956+
1957+
<p id="set">
1958+
<b class="header">set</b><code>_.set(object, path, value)</code><br>
1959+
Sets the value on <b>path</b> of <b>object</b>. <b>path</b> may be
1960+
specified as a simple key, or as an array of object keys or array
1961+
indexes. If the property does not exist, it will be created.
1962+
Returns mutated <b>object</b>.
1963+
</p>
1964+
<pre>
1965+
_.set({a: 10}, 'a', 50);
1966+
=&gt; {a: 50}
1967+
_.set({a: 10}, ['b', 0, 'value'], 50);
1968+
=&gt; {a: 10, b: [{value: 50}]}
19541969
</pre>
19551970

19561971
<p id="has">

modules/set.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function deepSet(obj, path, value) {
2424

2525
// Set the value on `path` of `object`.
2626
// If any property in `path` does not exist it will be created.
27-
// Returns mutated object (the first argument `obj`).
27+
// Returns mutated object (`obj`).
2828
export default function set(obj, path, value) {
2929
path = toPath(path);
3030

underscore-esm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

underscore-node-f.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ function deepSet(obj, path, value) {
857857

858858
// Set the value on `path` of `object`.
859859
// If any property in `path` does not exist it will be created.
860-
// Returns mutated object (the first argument `obj`).
860+
// Returns mutated object (`obj`).
861861
function set(obj, path, value) {
862862
path = toPath(path);
863863

underscore-umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)