mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Merge pull request #523 from chrisleishman/restrict
Add _.restrict(source, *keys)
This commit is contained in:
13
index.html
13
index.html
@@ -1014,6 +1014,19 @@ _.functions(_);
|
||||
<pre>
|
||||
_.extend({name : 'moe'}, {age : 50});
|
||||
=> {name : 'moe', age : 50}
|
||||
</pre>
|
||||
|
||||
<p id="restrict">
|
||||
<b class="header">restrict</b><code>_.restrict(source, *keys)</code>
|
||||
<br />
|
||||
Return a clone of the <b>source</b> with only the properties with the
|
||||
property names, or arrays of property names, provided in <b>keys</b>.
|
||||
</p>
|
||||
<pre>
|
||||
_.restrict({name : 'moe', age: 50, userid : 'moe1'}, 'name', 'age');
|
||||
=> {name : 'moe', age : 50}
|
||||
_.restrict({name : 'moe', age: 50, userid : 'moe1'}, ['name', 'age']);
|
||||
=> {name : 'moe', age : 50}
|
||||
</pre>
|
||||
|
||||
<p id="defaults">
|
||||
|
||||
Reference in New Issue
Block a user