mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
including docs for chaining
This commit is contained in:
34
index.html
34
index.html
@@ -108,7 +108,7 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="underscore.js">Development Version (0.4.0)</a></td>
|
||||
<td><i>16kb, Uncompressed with Comments</i></td>
|
||||
<td><i>18kb, Uncompressed with Comments</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="underscore-min.js">Production Version (0.4.0)</a></td>
|
||||
@@ -117,7 +117,7 @@
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<h2>Object-Oriented and Functional Styles</h2>
|
||||
<h2 id="styles">Object-Oriented and Functional Styles</h2>
|
||||
|
||||
<p>
|
||||
You can use Underscore in either an object-oriented or a functional style,
|
||||
@@ -205,6 +205,12 @@ _(lyrics).chain()
|
||||
<a href="#template">template</a></span>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Chaining</b>
|
||||
<br />
|
||||
<span class="methods"><a href="#chain">chain</a>, <a href="#get">get</a>
|
||||
</p>
|
||||
|
||||
<div id="documentation">
|
||||
|
||||
<h2>Collection Functions (Arrays or Objects)</h2>
|
||||
@@ -817,6 +823,30 @@ _.template(list, {people : ['moe', 'curly', 'larry']});
|
||||
=> "<li>moe</li><li>curly</li><li>larry</li>"
|
||||
</pre>
|
||||
|
||||
<h2>Chaining</h2>
|
||||
|
||||
<p id="chain">
|
||||
<b class="header">chain</b><code>_(obj).chain()</code>
|
||||
<br />
|
||||
Returns a wrapped object. Calling methods on this object will continue
|
||||
to return wrapped objects until <tt>get</tt> is used. (
|
||||
<a href="#styles">A more realistic example.</a>)
|
||||
</p>
|
||||
<pre>
|
||||
_({moe : false, curly : true}).chain().values().any().isEqual(true).get();
|
||||
=> true
|
||||
</pre>
|
||||
|
||||
<p id="get">
|
||||
<b class="header">get</b><code>_(obj).get()</code>
|
||||
<br />
|
||||
Extracts the value of a wrapped object.
|
||||
</p>
|
||||
<pre>
|
||||
_([1, 2, 3]).get();
|
||||
=> [1, 2, 3]
|
||||
</pre>
|
||||
|
||||
<h2>Change Log</h2>
|
||||
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user