Tizen 2.0 Release
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.2.0 / node_modules / grunt / node_modules / underscore / index.html
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4   <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
5   <meta http-equiv="X-UA-Compatible" content="chrome=1">
6   <title>Underscore.js</title>
7   <style>
8     body {
9       font-size: 14px;
10       line-height: 22px;
11       background: #f4f4f4 url(docs/images/background.png);
12       color: #000;
13       font-family: Helvetica Neue, Helvetica, Arial;      
14     }
15     .interface {
16       font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, sans-serif !important;
17     }
18     div#sidebar {
19       background: #fff;
20       position: fixed;
21       top: 0; left: 0; bottom: 0;
22       width: 200px;
23       overflow-y: auto;
24       overflow-x: hidden;
25       padding: 15px 0 30px 30px;
26       border-right: 1px solid #bbb;
27       box-shadow: 0 0 20px #ccc; -webkit-box-shadow: 0 0 20px #ccc; -moz-box-shadow: 0 0 20px #ccc;
28     }
29     a.toc_title, a.toc_title:visited {
30       display: block;
31       color: black;
32       font-weight: bold;
33       margin-top: 15px;
34     }
35       a.toc_title:hover {
36         text-decoration: underline;
37       }
38       #sidebar .version {
39         font-size: 10px;
40         font-weight: normal;
41       }
42     ul.toc_section {
43       font-size: 11px;
44       line-height: 14px;
45       margin: 5px 0 0 0;
46       padding-left: 0px;
47       list-style-type: none;
48       font-family: Lucida Grande;
49     }
50       .toc_section li {
51         cursor: pointer;
52         margin: 0 0 3px 0;
53       }
54         .toc_section li a {
55           text-decoration: none;
56           color: black;
57         }
58           .toc_section li a:hover {
59             text-decoration: underline;
60           }  
61     div.container {
62       width: 550px;
63       margin: 40px 0 50px 260px;
64     }
65     p {
66       margin: 20px 0;
67       width: 550px;
68     }
69     a, a:visited {
70       color: #444;
71     }
72     a:active, a:hover {
73       color: #000;
74     }
75     h1, h2, h3, h4, h5, h6 {
76       padding-top: 20px;
77     }
78       h2 {
79         font-size: 20px;
80       }
81     b.header {
82       font-size: 16px;
83       line-height: 30px;
84     }
85     span.alias {
86       font-size: 14px;
87       font-style: italic;
88       margin-left: 20px;
89     }
90     table, tr, td {
91       margin: 0; padding: 0;
92     }
93       td {
94         padding: 2px 12px 2px 0;
95       }
96     ul {
97       list-style-type: circle;
98       padding: 0 0 0 20px;
99     }
100       li {
101         width: 500px;
102         margin-bottom: 10px;
103       }
104       code, pre, tt {
105         font-family: Monaco, Consolas, "Lucida Console", monospace;
106         font-size: 12px;
107         line-height: 18px;
108         font-style: normal;
109       }
110         tt {
111           padding: 0px 3px;
112           background: #fff;
113           border: 1px solid #ddd;
114           zoom: 1;
115         }
116         code {
117           margin-left: 20px;
118         }
119         pre {
120           font-size: 12px;
121           padding: 2px 0 2px 15px;
122           border-left: 5px solid #bbb;
123           margin: 0px 0 30px;
124         }
125   </style>
126 </head>
127 <body>
128   
129   <div id="sidebar" class="interface">
130
131     <a class="toc_title" href="#">
132       Underscore.js <span class="version">(1.2.4)</span>
133     </a>
134     
135     <a class="toc_title" href="#">
136       Introduction
137     </a>
138
139     <a class="toc_title" href="#collections">
140       Collections
141     </a>
142     <ul class="toc_section">
143       <li>- <a href="#each">each</a></li>
144       <li>- <a href="#map">map</a></li>
145       <li>- <a href="#reduce">reduce</a></li>
146       <li>- <a href="#reduceRight">reduceRight</a></li>
147       <li>- <a href="#find">find</a></li>
148       <li>- <a href="#filter">filter</a></li>
149       <li>- <a href="#reject">reject</a></li>
150       <li>- <a href="#all">all</a></li>
151       <li>- <a href="#any">any</a></li>
152       <li>- <a href="#include">include</a></li>
153       <li>- <a href="#invoke">invoke</a></li>
154       <li>- <a href="#pluck">pluck</a></li>
155       <li>- <a href="#max">max</a></li>
156       <li>- <a href="#min">min</a></li>
157       <li>- <a href="#sortBy">sortBy</a></li>
158       <li>- <a href="#groupBy">groupBy</a></li>
159       <li>- <a href="#sortedIndex">sortedIndex</a></li>
160       <li>- <a href="#shuffle">shuffle</a></li>
161       <li>- <a href="#toArray">toArray</a></li>
162       <li>- <a href="#size">size</a></li>
163     </ul>
164
165     <a class="toc_title" href="#arrays">
166       Arrays
167     </a>
168     <ul class="toc_section">
169       <li>- <a href="#first">first</a></li>
170       <li>- <a href="#initial">initial</a></li>
171       <li>- <a href="#last">last</a></li>
172       <li>- <a href="#rest">rest</a></li>
173       <li>- <a href="#compact">compact</a></li>
174       <li>- <a href="#flatten">flatten</a></li>
175       <li>- <a href="#without">without</a></li>
176       <li>- <a href="#union">union</a></li>
177       <li>- <a href="#intersection">intersection</a></li>
178       <li>- <a href="#difference">difference</a></li>
179       <li>- <a href="#uniq">uniq</a></li>
180       <li>- <a href="#zip">zip</a></li>
181       <li>- <a href="#indexOf">indexOf</a></li>
182       <li>- <a href="#lastIndexOf">lastIndexOf</a></li>
183       <li>- <a href="#range">range</a></li>
184     </ul>
185
186     <a class="toc_title" href="#functions">
187       Functions
188     </a>
189     <ul class="toc_section">
190       <li>- <a href="#bind">bind</a></li>
191       <li>- <a href="#bindAll">bindAll</a></li>
192       <li>- <a href="#memoize">memoize</a></li>
193       <li>- <a href="#delay">delay</a></li>
194       <li>- <a href="#defer">defer</a></li>
195       <li>- <a href="#throttle">throttle</a></li>
196       <li>- <a href="#debounce">debounce</a></li>
197       <li>- <a href="#once">once</a></li>
198       <li>- <a href="#after">after</a></li>
199       <li>- <a href="#wrap">wrap</a></li>
200       <li>- <a href="#compose">compose</a></li>
201     </ul>
202
203     <a class="toc_title" href="#objects">
204       Objects
205     </a>
206     <ul class="toc_section">
207       <li>- <a href="#keys">keys</a></li>
208       <li>- <a href="#values">values</a></li>
209       <li>- <a href="#functions">functions</a></li>
210       <li>- <a href="#extend">extend</a></li>
211       <li>- <a href="#defaults">defaults</a></li>
212       <li>- <a href="#clone">clone</a></li>
213       <li>- <a href="#tap">tap</a></li>
214       <li>- <a href="#isEqual">isEqual</a></li>
215       <li>- <a href="#isEmpty">isEmpty</a></li>
216       <li>- <a href="#isElement">isElement</a></li>
217       <li>- <a href="#isArray">isArray</a></li>
218       <li>- <a href="#isArguments">isArguments</a></li>
219       <li>- <a href="#isFunction">isFunction</a></li>
220       <li>- <a href="#isString">isString</a></li>
221       <li>- <a href="#isNumber">isNumber</a></li>
222       <li>- <a href="#isBoolean">isBoolean</a></li>
223       <li>- <a href="#isDate">isDate</a></li>
224       <li>- <a href="#isRegExp">isRegExp</a></li>
225       <li>- <a href="#isNaN">isNaN</a></li>
226       <li>- <a href="#isNull">isNull</a></li>
227       <li>- <a href="#isUndefined">isUndefined</a></li>
228     </ul>
229
230     <a class="toc_title" href="#utility">
231       Utility
232     </a>    
233     <ul class="toc_section">
234       <li>- <a href="#noConflict">noConflict</a></li>
235       <li>- <a href="#identity">identity</a></li>
236       <li>- <a href="#times">times</a></li>
237       <li>- <a href="#mixin">mixin</a></li>
238       <li>- <a href="#uniqueId">uniqueId</a></li>
239       <li>- <a href="#escape">escape</a></li>
240       <li>- <a href="#template">template</a></li>
241     </ul>
242
243     <a class="toc_title" href="#chaining">
244       Chaining
245     </a>
246     <ul class="toc_section">
247       <li>- <a href="#chain">chain</a></li>
248       <li>- <a href="#value">value</a></li>
249     </ul>
250     
251     <a class="toc_title" href="#links">
252       Links
253     </a>
254     
255     <a class="toc_title" href="#changelog">
256       Change Log
257     </a>
258     
259   </div>
260
261   <div class="container">
262
263     <p id="introduction">
264       <img style="width: 396px; height: 69px;" src="docs/images/underscore.png" alt="Underscore.js" />
265     </p>
266
267     <p>
268       <a href="http://github.com/documentcloud/underscore/">Underscore</a> is a
269       utility-belt library for JavaScript that provides a lot of the
270       functional programming support that you would expect in
271       <a href="http://prototypejs.org/api">Prototype.js</a>
272       (or <a href="http://www.ruby-doc.org/core/classes/Enumerable.html">Ruby</a>),
273       but without extending any of the built-in JavaScript objects. It's the
274       tie to go along with <a href="http://docs.jquery.com">jQuery</a>'s tux,
275       and <a href="http://backbonejs.org">Backbone.js</a>'s suspenders.
276     </p>
277
278     <p>
279       Underscore provides 60-odd functions that support both the usual
280       functional suspects: <b>map</b>, <b>select</b>, <b>invoke</b> &mdash;
281       as well as more specialized helpers: function binding, javascript
282       templating, deep equality testing, and so on. It delegates to built-in
283       functions, if present, so modern browsers will use the
284       native implementations of <b>forEach</b>, <b>map</b>, <b>reduce</b>,
285       <b>filter</b>, <b>every</b>, <b>some</b> and <b>indexOf</b>.
286     </p>
287
288     <p>
289       A complete <a href="test/test.html">Test &amp; Benchmark Suite</a>
290       is included for your perusal.
291     </p>
292     
293     <p>
294       You may also read through the <a href="docs/underscore.html">annotated source code</a>.
295     </p>
296
297     <p>
298       The project is
299       <a href="http://github.com/documentcloud/underscore/">hosted on GitHub</a>.
300       You can report bugs and discuss features on the
301       <a href="http://github.com/documentcloud/underscore/issues">issues page</a>,
302       on Freenode in the <tt>#documentcloud</tt> channel,
303       or send tweets to <a href="http://twitter.com/documentcloud">@documentcloud</a>.
304     </p>
305
306     <p>
307       <i>Underscore is an open-source component of <a href="http://documentcloud.org/">DocumentCloud</a>.</i>
308     </p>
309
310     <h2>Downloads <i style="padding-left: 12px; font-size:12px;">(Right-click, and use "Save As")</i></h2>
311
312     <table>
313       <tr>
314         <td><a href="underscore.js">Development Version (1.2.4)</a></td>
315         <td><i>34kb, Uncompressed with Comments</i></td>
316       </tr>
317       <tr>
318         <td><a href="underscore-min.js">Production Version (1.2.4)</a></td>
319         <td><i>&lt; 4kb, Minified and Gzipped</i></td>
320       </tr>
321     </table>
322
323     <div id="documentation">
324
325       <h2 id="collections">Collection Functions (Arrays or Objects)</h2>
326
327       <p id="each">
328         <b class="header">each</b><code>_.each(list, iterator, [context])</code>
329         <span class="alias">Alias: <b>forEach</b></span>
330         <br />
331         Iterates over a <b>list</b> of elements, yielding each in turn to an <b>iterator</b>
332         function. The <b>iterator</b> is bound to the <b>context</b> object, if one is
333         passed. Each invocation of <b>iterator</b> is called with three arguments:
334         <tt>(element, index, list)</tt>. If <b>list</b> is a JavaScript object, <b>iterator</b>'s
335         arguments will be <tt>(value, key, list)</tt>. Delegates to the native
336         <b>forEach</b> function if it exists.
337       </p>
338       <pre>
339 _.each([1, 2, 3], function(num){ alert(num); });
340 =&gt; alerts each number in turn...
341 _.each({one : 1, two : 2, three : 3}, function(num, key){ alert(num); });
342 =&gt; alerts each number in turn...</pre>
343
344       <p id="map">
345         <b class="header">map</b><code>_.map(list, iterator, [context])</code>
346         <br />
347         Produces a new array of values by mapping each value in <b>list</b>
348         through a transformation function (<b>iterator</b>). If the native <b>map</b> method
349         exists, it will be used instead. If <b>list</b> is a JavaScript object,
350         <b>iterator</b>'s arguments will be <tt>(value, key, list)</tt>.
351       </p>
352       <pre>
353 _.map([1, 2, 3], function(num){ return num * 3; });
354 =&gt; [3, 6, 9]
355 _.map({one : 1, two : 2, three : 3}, function(num, key){ return num * 3; });
356 =&gt; [3, 6, 9]</pre>
357
358       <p id="reduce">
359         <b class="header">reduce</b><code>_.reduce(list, iterator, memo, [context])</code>
360         <span class="alias">Aliases: <b>inject, foldl</b></span>
361         <br />
362         Also known as <b>inject</b> and <b>foldl</b>, <b>reduce</b> boils down a
363         <b>list</b> of values into a single value. <b>Memo</b> is the initial state
364         of the reduction, and each successive step of it should be returned by
365         <b>iterator</b>.
366       </p>
367       <pre>
368 var sum = _.reduce([1, 2, 3], function(memo, num){ return memo + num; }, 0);
369 =&gt; 6
370 </pre>
371
372       <p id="reduceRight">
373         <b class="header">reduceRight</b><code>_.reduceRight(list, iterator, memo, [context])</code>
374         <span class="alias">Alias: <b>foldr</b></span>
375         <br />
376         The right-associative version of <b>reduce</b>. Delegates to the
377         JavaScript 1.8 version of <b>reduceRight</b>, if it exists. <b>Foldr</b>
378         is not as useful in JavaScript as it would be in a language with lazy
379         evaluation.
380       </p>
381       <pre>
382 var list = [[0, 1], [2, 3], [4, 5]];
383 var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
384 =&gt; [4, 5, 2, 3, 0, 1]
385 </pre>
386
387       <p id="find">
388         <b class="header">find</b><code>_.find(list, iterator, [context])</code>
389         <span class="alias">Alias: <b>detect</b></span>
390         <br />
391         Looks through each value in the <b>list</b>, returning the first one that
392         passes a truth test (<b>iterator</b>). The function returns as
393         soon as it finds an acceptable element, and doesn't traverse the
394         entire list.
395       </p>
396       <pre>
397 var even = _.find([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
398 =&gt; 2
399 </pre>
400
401       <p id="filter">
402         <b class="header">filter</b><code>_.filter(list, iterator, [context])</code>
403         <span class="alias">Alias: <b>select</b></span>
404         <br />
405         Looks through each value in the <b>list</b>, returning an array of all
406         the values that pass a truth test (<b>iterator</b>). Delegates to the
407         native <b>filter</b> method, if it exists.
408       </p>
409       <pre>
410 var evens = _.filter([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
411 =&gt; [2, 4, 6]
412 </pre>
413
414       <p id="reject">
415         <b class="header">reject</b><code>_.reject(list, iterator, [context])</code>
416         <br />
417         Returns the values in <b>list</b> without the elements that the truth
418         test (<b>iterator</b>) passes. The opposite of <b>filter</b>.
419       </p>
420       <pre>
421 var odds = _.reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
422 =&gt; [1, 3, 5]
423 </pre>
424
425       <p id="all">
426         <b class="header">all</b><code>_.all(list, iterator, [context])</code>
427         <span class="alias">Alias: <b>every</b></span>
428         <br />
429         Returns <i>true</i> if all of the values in the <b>list</b> pass the <b>iterator</b>
430         truth test. Delegates to the native method <b>every</b>, if present.
431       </p>
432       <pre>
433 _.all([true, 1, null, 'yes'], _.identity);
434 =&gt; false
435 </pre>
436
437       <p id="any">
438         <b class="header">any</b><code>_.any(list, [iterator], [context])</code>
439         <span class="alias">Alias: <b>some</b></span>
440         <br />
441         Returns <i>true</i> if any of the values in the <b>list</b> pass the
442         <b>iterator</b> truth test. Short-circuits and stops traversing the list
443         if a true element is found. Delegates to the native method <b>some</b>,
444         if present.
445       </p>
446       <pre>
447 _.any([null, 0, 'yes', false]);
448 =&gt; true
449 </pre>
450
451       <p id="include">
452         <b class="header">include</b><code>_.include(list, value)</code>
453         <span class="alias">Alias: <b>contains</b></span>
454         <br />
455         Returns <i>true</i> if the <b>value</b> is present in the <b>list</b>, using
456         <i>===</i> to test equality. Uses <b>indexOf</b> internally, if <b>list</b>
457         is an Array.
458       </p>
459       <pre>
460 _.include([1, 2, 3], 3);
461 =&gt; true
462 </pre>
463
464       <p id="invoke">
465         <b class="header">invoke</b><code>_.invoke(list, methodName, [*arguments])</code>
466         <br />
467         Calls the method named by <b>methodName</b> on each value in the <b>list</b>.
468         Any extra arguments passed to <b>invoke</b> will be forwarded on to the
469         method invocation.
470       </p>
471       <pre>
472 _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
473 =&gt; [[1, 5, 7], [1, 2, 3]]
474 </pre>
475
476       <p id="pluck">
477         <b class="header">pluck</b><code>_.pluck(list, propertyName)</code>
478         <br />
479         A convenient version of what is perhaps the most common use-case for
480         <b>map</b>: extracting a list of property values.
481       </p>
482       <pre>
483 var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'curly', age : 60}];
484 _.pluck(stooges, 'name');
485 =&gt; ["moe", "larry", "curly"]
486 </pre>
487
488       <p id="max">
489         <b class="header">max</b><code>_.max(list, [iterator], [context])</code>
490         <br />
491         Returns the maximum value in <b>list</b>. If <b>iterator</b> is passed,
492         it will be used on each value to generate the criterion by which the
493         value is ranked.
494       </p>
495       <pre>
496 var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'curly', age : 60}];
497 _.max(stooges, function(stooge){ return stooge.age; });
498 =&gt; {name : 'curly', age : 60};
499 </pre>
500
501       <p id="min">
502         <b class="header">min</b><code>_.min(list, [iterator], [context])</code>
503         <br />
504         Returns the minimum value in <b>list</b>. If <b>iterator</b> is passed,
505         it will be used on each value to generate the criterion by which the
506         value is ranked.
507       </p>
508       <pre>
509 var numbers = [10, 5, 100, 2, 1000];
510 _.min(numbers);
511 =&gt; 2
512 </pre>
513
514       <p id="sortBy">
515         <b class="header">sortBy</b><code>_.sortBy(list, iterator, [context])</code>
516         <br />
517         Returns a sorted copy of <b>list</b>, ranked by the results of running 
518         each value through <b>iterator</b>.
519       </p>
520       <pre>
521 _.sortBy([1, 2, 3, 4, 5, 6], function(num){ return Math.sin(num); });
522 =&gt; [5, 4, 6, 3, 1, 2]
523 </pre>
524
525       <p id="groupBy">
526         <b class="header">groupBy</b><code>_.groupBy(list, iterator)</code>
527         <br />
528         Splits a collection into sets, grouped by the result of running each
529         value through <b>iterator</b>. If <b>iterator</b> is a string instead of
530         a function, groups by the property named by <b>iterator</b> on each of
531         the values.
532       </p>
533       <pre>
534 _.groupBy([1.3, 2.1, 2.4], function(num){ return Math.floor(num); });
535 =&gt; {1: [1.3], 2: [2.1, 2.4]}
536
537 _.groupBy(['one', 'two', 'three'], 'length');
538 =&gt; {3: ["one", "two"], 5: ["three"]}
539 </pre>
540
541       <p id="sortedIndex">
542         <b class="header">sortedIndex</b><code>_.sortedIndex(list, value, [iterator])</code>
543         <br />
544         Uses a binary search to determine the index at which the <b>value</b>
545         <i>should</i> be inserted into the <b>list</b> in order to maintain the <b>list</b>'s
546         sorted order. If an <b>iterator</b> is passed, it will be used to compute
547         the sort ranking of each value.
548       </p>
549       <pre>
550 _.sortedIndex([10, 20, 30, 40, 50], 35);
551 =&gt; 3
552 </pre>
553
554       <p id="shuffle">
555         <b class="header">shuffle</b><code>_.shuffle(list)</code>
556         <br />
557         Returns a shuffled copy of the <b>list</b>, using a version of the 
558         <a href="http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">Fisher-Yates shuffle</a>.
559       </p>
560       <pre>
561 _.shuffle([1, 2, 3, 4, 5, 6]);
562 =&gt; [4, 1, 6, 3, 5, 2]
563 </pre>
564
565       <p id="toArray">
566         <b class="header">toArray</b><code>_.toArray(list)</code>
567         <br />
568         Converts the <b>list</b> (anything that can be iterated over), into a
569         real Array. Useful for transmuting the <b>arguments</b> object.
570       </p>
571       <pre>
572 (function(){ return _.toArray(arguments).slice(0); })(1, 2, 3);
573 =&gt; [1, 2, 3]
574 </pre>
575
576       <p id="size">
577         <b class="header">size</b><code>_.size(list)</code>
578         <br />
579         Return the number of values in the <b>list</b>.
580       </p>
581       <pre>
582 _.size({one : 1, two : 2, three : 3});
583 =&gt; 3
584 </pre>
585
586       <h2 id="arrays">Array Functions</h2>
587
588       <p>
589         <i>Note: All array functions will also work on the <b>arguments</b> object.</i>
590       </p>
591
592       <p id="first">
593         <b class="header">first</b><code>_.first(array, [n])</code>
594         <span class="alias">Alias: <b>head</b></span>
595         <br />
596         Returns the first element of an <b>array</b>. Passing <b>n</b> will
597         return the first <b>n</b> elements of the array.
598       </p>
599       <pre>
600 _.first([5, 4, 3, 2, 1]);
601 =&gt; 5
602 </pre>
603
604       <p id="initial">
605         <b class="header">initial</b><code>_.initial(array, [n])</code>
606         <br />
607         Returns everything but the last entry of the array. Especially useful on
608         the arguments object. Pass <b>n</b> to exclude the last <b>n</b> elements
609         from the result.
610       </p>
611       <pre>
612 _.initial([5, 4, 3, 2, 1]);
613 =&gt; [5, 4, 3, 2]
614 </pre>
615
616       <p id="last">
617         <b class="header">last</b><code>_.last(array, [n])</code>
618         <br />
619         Returns the last element of an <b>array</b>. Passing <b>n</b> will return
620         the last <b>n</b> elements of the array.
621       </p>
622       <pre>
623 _.last([5, 4, 3, 2, 1]);
624 =&gt; 1
625 </pre>
626
627       <p id="rest">
628         <b class="header">rest</b><code>_.rest(array, [index])</code>
629         <span class="alias">Alias: <b>tail</b></span>
630         <br />
631         Returns the <b>rest</b> of the elements in an array. Pass an <b>index</b>
632         to return the values of the array from that index onward.
633       </p>
634       <pre>
635 _.rest([5, 4, 3, 2, 1]);
636 =&gt; [4, 3, 2, 1]
637 </pre>
638
639       <p id="compact">
640         <b class="header">compact</b><code>_.compact(array)</code>
641         <br />
642         Returns a copy of the <b>array</b> with all falsy values removed.
643         In JavaScript, <i>false</i>, <i>null</i>, <i>0</i>, <i>""</i>,
644         <i>undefined</i> and <i>NaN</i> are all falsy.
645       </p>
646       <pre>
647 _.compact([0, 1, false, 2, '', 3]);
648 =&gt; [1, 2, 3]
649 </pre>
650
651       <p id="flatten">
652         <b class="header">flatten</b><code>_.flatten(array)</code>
653         <br />
654         Flattens a nested <b>array</b> (the nesting can be to any depth).
655       </p>
656       <pre>
657 _.flatten([1, [2], [3, [[[4]]]]]);
658 =&gt; [1, 2, 3, 4];
659 </pre>
660
661       <p id="without">
662         <b class="header">without</b><code>_.without(array, [*values])</code>
663         <br />
664         Returns a copy of the <b>array</b> with all instances of the <b>values</b>
665         removed. <i>===</i> is used for the equality test.
666       </p>
667       <pre>
668 _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
669 =&gt; [2, 3, 4]
670 </pre>
671
672       <p id="union">
673         <b class="header">union</b><code>_.union(*arrays)</code>
674         <br />
675         Computes the union of the passed-in <b>arrays</b>: the list of unique items,
676         in order, that are present in one or more of the <b>arrays</b>.
677       </p>
678       <pre>
679 _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
680 =&gt; [1, 2, 3, 101, 10]
681 </pre>
682
683       <p id="intersection">
684         <b class="header">intersection</b><code>_.intersection(*arrays)</code>
685         <br />
686         Computes the list of values that are the intersection of all the <b>arrays</b>.
687         Each value in the result is present in each of the <b>arrays</b>.
688       </p>
689       <pre>
690 _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
691 =&gt; [1, 2]
692 </pre>
693
694       <p id="difference">
695         <b class="header">difference</b><code>_.difference(array, *others)</code>
696         <br />
697         Similar to <b>without</b>, but returns the values from <b>array</b> that
698         are not present in the <b>other</b> arrays.
699       </p>
700       <pre>
701 _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
702 =&gt; [1, 3, 4]
703 </pre>
704
705       <p id="uniq">
706         <b class="header">uniq</b><code>_.uniq(array, [isSorted], [iterator])</code>
707         <span class="alias">Alias: <b>unique</b></span>
708         <br />
709         Produces a duplicate-free version of the <b>array</b>, using <i>===</i> to test
710         object equality. If you know in advance that the <b>array</b> is sorted,
711         passing <i>true</i> for <b>isSorted</b> will run a much faster algorithm.
712         If you want to compute unique items based on a transformation, pass an
713         <b>iterator</b> function.
714       </p>
715       <pre>
716 _.uniq([1, 2, 1, 3, 1, 4]);
717 =&gt; [1, 2, 3, 4]
718 </pre>
719
720       <p id="zip">
721         <b class="header">zip</b><code>_.zip(*arrays)</code>
722         <br />
723         Merges together the values of each of the <b>arrays</b> with the
724         values at the corresponding position. Useful when you have separate
725         data sources that are coordinated through matching array indexes.
726         If you're working with a matrix of nested arrays, <b>zip.apply</b>
727         can transpose the matrix in a similar fashion.
728       </p>
729       <pre>
730 _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]);
731 =&gt; [["moe", 30, true], ["larry", 40, false], ["curly", 50, false]]
732 </pre>
733
734       <p id="indexOf">
735         <b class="header">indexOf</b><code>_.indexOf(array, value, [isSorted])</code>
736         <br />
737         Returns the index at which <b>value</b> can be found in the <b>array</b>,
738         or <i>-1</i> if value is not present in the <b>array</b>. Uses the native
739         <b>indexOf</b> function unless it's missing. If you're working with a 
740         large array, and you know that the array is already sorted, pass <tt>true</tt>
741         for <b>isSorted</b> to use a faster binary search.
742       </p>
743       <pre>
744 _.indexOf([1, 2, 3], 2);
745 =&gt; 1
746 </pre>
747
748       <p id="lastIndexOf">
749         <b class="header">lastIndexOf</b><code>_.lastIndexOf(array, value)</code>
750         <br />
751         Returns the index of the last occurrence of <b>value</b> in the <b>array</b>,
752         or <i>-1</i> if value is not present. Uses the native <b>lastIndexOf</b>
753         function if possible.
754       </p>
755       <pre>
756 _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
757 =&gt; 4
758 </pre>
759
760       <p id="range">
761         <b class="header">range</b><code>_.range([start], stop, [step])</code>
762         <br />
763         A function to create flexibly-numbered lists of integers, handy for
764         <tt>each</tt> and <tt>map</tt> loops. <b>start</b>, if omitted, defaults
765         to <i>0</i>; <b>step</b> defaults to <i>1</i>. Returns a list of integers
766         from <b>start</b> to <b>stop</b>, incremented (or decremented) by <b>step</b>,
767         exclusive.
768       </p>
769       <pre>
770 _.range(10);
771 =&gt; [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
772 _.range(1, 11);
773 =&gt; [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
774 _.range(0, 30, 5);
775 =&gt; [0, 5, 10, 15, 20, 25]
776 _.range(0, -10, -1);
777 =&gt; [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
778 _.range(0);
779 =&gt; []
780 </pre>
781
782       <h2 id="functions">Function (uh, ahem) Functions</h2>
783
784       <p id="bind">
785         <b class="header">bind</b><code>_.bind(function, object, [*arguments])</code>
786         <br />
787         Bind a <b>function</b> to an <b>object</b>, meaning that whenever
788         the function is called, the value of <i>this</i> will be the <b>object</b>.
789         Optionally, bind <b>arguments</b> to the <b>function</b> to pre-fill them,
790         also known as <b>partial application</b>.
791       </p>
792       <pre>
793 var func = function(greeting){ return greeting + ': ' + this.name };
794 func = _.bind(func, {name : 'moe'}, 'hi');
795 func();
796 =&gt; 'hi: moe'
797 </pre>
798
799       <p id="bindAll">
800         <b class="header">bindAll</b><code>_.bindAll(object, [*methodNames])</code>
801         <br />
802         Binds a number of methods on the <b>object</b>, specified by
803         <b>methodNames</b>, to be run in the context of that object whenever they
804         are invoked. Very handy for binding functions that are going to be used
805         as event handlers, which would otherwise be invoked with a fairly useless
806         <i>this</i>. If no <b>methodNames</b> are provided, all of the object's
807         function properties will be bound to it.
808       </p>
809       <pre>
810 var buttonView = {
811   label   : 'underscore',
812   onClick : function(){ alert('clicked: ' + this.label); },
813   onHover : function(){ console.log('hovering: ' + this.label); }
814 };
815 _.bindAll(buttonView);
816 jQuery('#underscore_button').bind('click', buttonView.onClick);
817 =&gt; When the button is clicked, this.label will have the correct value...
818 </pre>
819
820       <p id="memoize">
821         <b class="header">memoize</b><code>_.memoize(function, [hashFunction])</code>
822         <br />
823         Memoizes a given <b>function</b> by caching the computed result. Useful
824         for speeding up slow-running computations. If passed an optional 
825         <b>hashFunction</b>, it will be used to compute the hash key for storing
826         the result, based on the arguments to the original function. The default
827         <b>hashFunction</b> just uses the first argument to the memoized function
828         as the key.
829       </p>
830       <pre>
831 var fibonacci = _.memoize(function(n) {
832   return n &lt; 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
833 });
834 </pre>
835
836       <p id="delay">
837         <b class="header">delay</b><code>_.delay(function, wait, [*arguments])</code>
838         <br />
839         Much like <b>setTimeout</b>, invokes <b>function</b> after <b>wait</b>
840         milliseconds. If you pass the optional <b>arguments</b>, they will be
841         forwarded on to the <b>function</b> when it is invoked.
842       </p>
843       <pre>
844 var log = _.bind(console.log, console);
845 _.delay(log, 1000, 'logged later');
846 =&gt; 'logged later' // Appears after one second.
847 </pre>
848
849       <p id="defer">
850         <b class="header">defer</b><code>_.defer(function)</code>
851         <br />
852         Defers invoking the <b>function</b> until the current call stack has cleared,
853         similar to using <b>setTimeout</b> with a delay of 0. Useful for performing
854         expensive computations or HTML rendering in chunks without blocking the UI thread
855         from updating.
856       </p>
857       <pre>
858 _.defer(function(){ alert('deferred'); });
859 // Returns from the function before the alert runs.
860 </pre>
861
862       <p id="throttle">
863         <b class="header">throttle</b><code>_.throttle(function, wait)</code>
864         <br />
865         Creates and returns a new, throttled version of the passed function, 
866         that, when invoked repeatedly, will only actually call the original function 
867         at most once per every <b>wait</b>
868         milliseconds. Useful for rate-limiting events that occur faster than you
869         can keep up with.
870       </p>
871       <pre>
872 var throttled = _.throttle(updatePosition, 100);
873 $(window).scroll(throttled);
874 </pre>
875
876       <p id="debounce">
877         <b class="header">debounce</b><code>_.debounce(function, wait)</code>
878         <br />
879         Creates and returns a new debounced version of the passed function that
880         will postpone its execution until after 
881         <b>wait</b> milliseconds have elapsed since the last time it  
882         was invoked. Useful for implementing behavior that should only happen 
883         <i>after</i> the input has stopped arriving. For example: rendering a 
884         preview of a Markdown comment, recalculating a layout after the window 
885         has stopped being resized, and so on.
886       </p>
887       <pre>
888 var lazyLayout = _.debounce(calculateLayout, 300);
889 $(window).resize(lazyLayout);
890 </pre>
891
892       <p id="once">
893         <b class="header">once</b><code>_.once(function)</code>
894         <br />
895         Creates a version of the function that can only be called one time. 
896         Repeated calls to the modified function will have no effect, returning
897         the value from the original call. Useful for initialization functions,
898         instead of having to set a boolean flag and then check it later.
899       </p>
900       <pre>
901 var initialize = _.once(createApplication);
902 initialize();
903 initialize();
904 // Application is only created once.
905 </pre>
906
907       <p id="after">
908         <b class="header">after</b><code>_.after(count, function)</code>
909         <br />
910         Creates a version of the function that will only be run after first 
911         being called <b>count</b> times. Useful for grouping asynchronous responses,
912         where you want to be sure that all the async calls have finished, before
913         proceeding.
914       </p>
915       <pre>
916 var renderNotes = _.after(notes.length, render);
917 _.each(notes, function(note) {
918   note.asyncSave({success: renderNotes}); 
919 });
920 // renderNotes is run once, after all notes have saved.
921 </pre>
922
923       <p id="wrap">
924         <b class="header">wrap</b><code>_.wrap(function, wrapper)</code>
925         <br />
926         Wraps the first <b>function</b> inside of the <b>wrapper</b> function,
927         passing it as the first argument. This allows the <b>wrapper</b> to
928         execute code before and after the <b>function</b> runs, adjust the arguments,
929         and execute it conditionally.
930       </p>
931       <pre>
932 var hello = function(name) { return "hello: " + name; };
933 hello = _.wrap(hello, function(func) {
934   return "before, " + func("moe") + ", after";
935 });
936 hello();
937 =&gt; 'before, hello: moe, after'
938 </pre>
939
940       <p id="compose">
941         <b class="header">compose</b><code>_.compose(*functions)</code>
942         <br />
943         Returns the composition of a list of <b>functions</b>, where each function
944         consumes the return value of the function that follows. In math terms,
945         composing the functions <i>f()</i>, <i>g()</i>, and <i>h()</i> produces
946         <i>f(g(h()))</i>.
947       </p>
948       <pre>
949 var greet    = function(name){ return "hi: " + name; };
950 var exclaim  = function(statement){ return statement + "!"; };
951 var welcome = _.compose(exclaim, greet);
952 welcome('moe');
953 =&gt; 'hi: moe!'
954 </pre>
955
956       <h2 id="objects">Object Functions</h2>
957
958       <p id="keys">
959         <b class="header">keys</b><code>_.keys(object)</code>
960         <br />
961         Retrieve all the names of the <b>object</b>'s properties.
962       </p>
963       <pre>
964 _.keys({one : 1, two : 2, three : 3});
965 =&gt; ["one", "two", "three"]
966 </pre>
967
968       <p id="values">
969         <b class="header">values</b><code>_.values(object)</code>
970         <br />
971         Return all of the values of the <b>object</b>'s properties.
972       </p>
973       <pre>
974 _.values({one : 1, two : 2, three : 3});
975 =&gt; [1, 2, 3]
976 </pre>
977
978       <p id="functions">
979         <b class="header">functions</b><code>_.functions(object)</code>
980         <span class="alias">Alias: <b>methods</b></span>
981         <br />
982         Returns a sorted list of the names of every method in an object &mdash;
983         that is to say, the name of every function property of the object.
984       </p>
985       <pre>
986 _.functions(_);
987 =&gt; ["all", "any", "bind", "bindAll", "clone", "compact", "compose" ...
988 </pre>
989
990       <p id="extend">
991         <b class="header">extend</b><code>_.extend(destination, *sources)</code>
992         <br />
993         Copy all of the properties in the <b>source</b> objects over to the
994         <b>destination</b> object. It's in-order, so the last source will override
995         properties of the same name in previous arguments.
996       </p>
997       <pre>
998 _.extend({name : 'moe'}, {age : 50});
999 =&gt; {name : 'moe', age : 50}
1000 </pre>
1001
1002       <p id="defaults">
1003         <b class="header">defaults</b><code>_.defaults(object, *defaults)</code>
1004         <br />
1005         Fill in missing properties in <b>object</b> with default values from the
1006         <b>defaults</b> objects. As soon as the property is filled, further defaults
1007         will have no effect.
1008       </p>
1009       <pre>
1010 var iceCream = {flavor : "chocolate"};
1011 _.defaults(iceCream, {flavor : "vanilla", sprinkles : "lots"});
1012 =&gt; {flavor : "chocolate", sprinkles : "lots"}
1013 </pre>
1014
1015       <p id="clone">
1016         <b class="header">clone</b><code>_.clone(object)</code>
1017         <br />
1018         Create a shallow-copied clone of the <b>object</b>. Any nested objects
1019         or arrays will be copied by reference, not duplicated.
1020       </p>
1021       <pre>
1022 _.clone({name : 'moe'});
1023 =&gt; {name : 'moe'};
1024 </pre>
1025
1026       <p id="tap">
1027         <b class="header">tap</b><code>_.tap(object, interceptor)</code>
1028         <br />
1029         Invokes <b>interceptor</b> with the <b>object</b>, and then returns <b>object</b>.
1030         The primary purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
1031       </p>
1032       <pre>
1033 _.chain([1,2,3,200])
1034   .filter(function(num) { return num % 2 == 0; })
1035   .tap(console.log)
1036   .map(function(num) { return num * num })
1037   .value();
1038 =&gt; [2, 200]
1039 =&gt; [4, 40000]
1040 </pre>
1041
1042       <p id="isEqual">
1043         <b class="header">isEqual</b><code>_.isEqual(object, other)</code>
1044         <br />
1045         Performs an optimized deep comparison between the two objects, to determine
1046         if they should be considered equal.
1047       </p>
1048       <pre>
1049 var moe   = {name : 'moe', luckyNumbers : [13, 27, 34]};
1050 var clone = {name : 'moe', luckyNumbers : [13, 27, 34]};
1051 moe == clone;
1052 =&gt; false
1053 _.isEqual(moe, clone);
1054 =&gt; true
1055 </pre>
1056
1057       <p id="isEmpty">
1058         <b class="header">isEmpty</b><code>_.isEmpty(object)</code>
1059         <br />
1060         Returns <i>true</i> if <b>object</b> contains no values.
1061       </p>
1062       <pre>
1063 _.isEmpty([1, 2, 3]);
1064 =&gt; false
1065 _.isEmpty({});
1066 =&gt; true
1067 </pre>
1068
1069       <p id="isElement">
1070         <b class="header">isElement</b><code>_.isElement(object)</code>
1071         <br />
1072         Returns <i>true</i> if <b>object</b> is a DOM element.
1073       </p>
1074       <pre>
1075 _.isElement(jQuery('body')[0]);
1076 =&gt; true
1077 </pre>
1078
1079       <p id="isArray">
1080         <b class="header">isArray</b><code>_.isArray(object)</code>
1081         <br />
1082         Returns <i>true</i> if <b>object</b> is an Array.
1083       </p>
1084       <pre>
1085 (function(){ return _.isArray(arguments); })();
1086 =&gt; false
1087 _.isArray([1,2,3]);
1088 =&gt; true
1089 </pre>
1090
1091       <p id="isArguments">
1092         <b class="header">isArguments</b><code>_.isArguments(object)</code>
1093         <br />
1094         Returns <i>true</i> if <b>object</b> is an Arguments object.
1095       </p>
1096       <pre>
1097 (function(){ return _.isArguments(arguments); })(1, 2, 3);
1098 =&gt; true
1099 _.isArguments([1,2,3]);
1100 =&gt; false
1101 </pre>
1102
1103       <p id="isFunction">
1104         <b class="header">isFunction</b><code>_.isFunction(object)</code>
1105         <br />
1106         Returns <i>true</i> if <b>object</b> is a Function.
1107       </p>
1108       <pre>
1109 _.isFunction(alert);
1110 =&gt; true
1111 </pre>
1112
1113       <p id="isString">
1114         <b class="header">isString</b><code>_.isString(object)</code>
1115         <br />
1116         Returns <i>true</i> if <b>object</b> is a String.
1117       </p>
1118       <pre>
1119 _.isString("moe");
1120 =&gt; true
1121 </pre>
1122
1123       <p id="isNumber">
1124         <b class="header">isNumber</b><code>_.isNumber(object)</code>
1125         <br />
1126         Returns <i>true</i> if <b>object</b> is a Number (including <tt>NaN</tt>).
1127       </p>
1128       <pre>
1129 _.isNumber(8.4 * 5);
1130 =&gt; true
1131 </pre>
1132
1133       <p id="isBoolean">
1134         <b class="header">isBoolean</b><code>_.isBoolean(object)</code>
1135         <br />
1136         Returns <i>true</i> if <b>object</b> is either <i>true</i> or <i>false</i>.
1137       </p>
1138       <pre>
1139 _.isBoolean(null);
1140 =&gt; false
1141 </pre>
1142
1143       <p id="isDate">
1144         <b class="header">isDate</b><code>_.isDate(object)</code>
1145         <br />
1146         Returns <i>true</i> if <b>object</b> is a Date.
1147       </p>
1148       <pre>
1149 _.isDate(new Date());
1150 =&gt; true
1151 </pre>
1152
1153       <p id="isRegExp">
1154         <b class="header">isRegExp</b><code>_.isRegExp(object)</code>
1155         <br />
1156         Returns <i>true</i> if <b>object</b> is a RegExp.
1157       </p>
1158       <pre>
1159 _.isRegExp(/moe/);
1160 =&gt; true
1161 </pre>
1162
1163       <p id="isNaN">
1164         <b class="header">isNaN</b><code>_.isNaN(object)</code>
1165         <br />
1166         Returns <i>true</i> if <b>object</b> is <i>NaN</i>.<br /> Note: this is not
1167         the same as the native <b>isNaN</b> function, which will also return
1168         true if the variable is <i>undefined</i>.
1169       </p>
1170       <pre>
1171 _.isNaN(NaN);
1172 =&gt; true
1173 isNaN(undefined);
1174 =&gt; true
1175 _.isNaN(undefined);
1176 =&gt; false
1177 </pre>
1178
1179       <p id="isNull">
1180         <b class="header">isNull</b><code>_.isNull(object)</code>
1181         <br />
1182         Returns <i>true</i> if the value of <b>object</b> is <i>null</i>.
1183       </p>
1184       <pre>
1185 _.isNull(null);
1186 =&gt; true
1187 _.isNull(undefined);
1188 =&gt; false
1189 </pre>
1190
1191       <p id="isUndefined">
1192         <b class="header">isUndefined</b><code>_.isUndefined(variable)</code>
1193         <br />
1194         Returns <i>true</i> if <b>variable</b> is <i>undefined</i>.
1195       </p>
1196       <pre>
1197 _.isUndefined(window.missingVariable);
1198 =&gt; true
1199 </pre>
1200
1201       <h2 id="utility">Utility Functions</h2>
1202
1203       <p id="noConflict">
1204         <b class="header">noConflict</b><code>_.noConflict()</code>
1205         <br />
1206         Give control of the "_" variable back to its previous owner. Returns
1207         a reference to the <b>Underscore</b> object.
1208       </p>
1209       <pre>
1210 var underscore = _.noConflict();</pre>
1211
1212       <p id="identity">
1213         <b class="header">identity</b><code>_.identity(value)</code>
1214         <br />
1215         Returns the same value that is used as the argument. In math:
1216         <tt>f(x) = x</tt><br />
1217         This function looks useless, but is used throughout Underscore as
1218         a default iterator.
1219       </p>
1220       <pre>
1221 var moe = {name : 'moe'};
1222 moe === _.identity(moe);
1223 =&gt; true</pre>
1224
1225       <p id="times">
1226         <b class="header">times</b><code>_.times(n, iterator)</code>
1227         <br />
1228         Invokes the given iterator function <b>n</b> times.
1229       </p>
1230       <pre>
1231 _(3).times(function(){ genie.grantWish(); });</pre>
1232
1233       <p id="mixin">
1234         <b class="header">mixin</b><code>_.mixin(object)</code>
1235         <br />
1236         Allows you to extend Underscore with your own utility functions. Pass
1237         a hash of <tt>{name: function}</tt> definitions to have your functions 
1238         added to the Underscore object, as well as the OOP wrapper.
1239       </p>
1240       <pre>
1241 _.mixin({
1242   capitalize : function(string) {
1243     return string.charAt(0).toUpperCase() + string.substring(1).toLowerCase();
1244   }
1245 });
1246 _("fabio").capitalize();
1247 =&gt; "Fabio"
1248 </pre>
1249
1250       <p id="uniqueId">
1251         <b class="header">uniqueId</b><code>_.uniqueId([prefix])</code>
1252         <br />
1253         Generate a globally-unique id for client-side models or DOM elements
1254         that need one. If <b>prefix</b> is passed, the id will be appended to it.
1255       </p>
1256       <pre>
1257 _.uniqueId('contact_');
1258 =&gt; 'contact_104'</pre>
1259
1260       <p id="escape">
1261         <b class="header">escape</b><code>_.escape(string)</code>
1262         <br />
1263         Escapes a string for insertion into HTML, replacing 
1264         <tt>&amp;</tt>, <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&quot;</tt>, <tt>&#x27;</tt>, and <tt>&#x2F;</tt> characters.
1265       </p>
1266       <pre>
1267 _.escape('Curly, Larry &amp; Moe');
1268 =&gt; "Curly, Larry &amp;amp; Moe"</pre>
1269
1270       <p id="template">
1271         <b class="header">template</b><code>_.template(templateString, [context])</code>
1272         <br />
1273         Compiles JavaScript templates into functions that can be evaluated
1274         for rendering. Useful for rendering complicated bits of HTML from JSON
1275         data sources. Template functions can both interpolate variables, using<br />
1276         <tt>&lt;%= &hellip; %&gt;</tt>, as well as execute arbitrary JavaScript code, with
1277         <tt>&lt;% &hellip; %&gt;</tt>. If you wish to interpolate a value, and have
1278         it be HTML-escaped, use <tt>&lt;%- &hellip; %&gt;</tt> When you evaluate a template function, pass in a
1279         <b>context</b> object that has properties corresponding to the template's free
1280         variables. If you're writing a one-off, you can pass the <b>context</b>
1281         object as the second parameter to <b>template</b> in order to render
1282         immediately instead of returning a template function.
1283       </p>
1284       <pre>
1285 var compiled = _.template("hello: &lt;%= name %&gt;");
1286 compiled({name : 'moe'});
1287 =&gt; "hello: moe"
1288
1289 var list = "&lt;% _.each(people, function(name) { %&gt; &lt;li&gt;&lt;%= name %&gt;&lt;/li&gt; &lt;% }); %&gt;";
1290 _.template(list, {people : ['moe', 'curly', 'larry']});
1291 =&gt; "&lt;li&gt;moe&lt;/li&gt;&lt;li&gt;curly&lt;/li&gt;&lt;li&gt;larry&lt;/li&gt;"
1292
1293 var template = _.template("&lt;b&gt;&lt;%- value %&gt;&lt;/b&gt;");
1294 template({value : '&lt;script&gt;'});
1295 =&gt; "&lt;b&gt;&amp;lt;script&amp;gt;&lt;/b&gt;"</pre>
1296
1297       <p>
1298         You can also use <tt>print</tt> from within JavaScript code.  This is
1299         sometimes more convenient than using <tt>&lt;%= ... %&gt;</tt>.
1300       </p>
1301       
1302       <pre>
1303 var compiled = _.template("&lt;% print('Hello ' + epithet); %&gt;");
1304 compiled({epithet: "stooge"});
1305 =&gt; "Hello stooge."</pre>
1306
1307       <p>
1308         If ERB-style delimiters aren't your cup of tea, you can change Underscore's
1309         template settings to use different symbols to set off interpolated code.
1310         Define an <b>interpolate</b> regex to match expressions that should be 
1311         interpolated verbatim, an <b>escape</b> regex to match expressions that should 
1312         be inserted after being HTML escaped, and an <b>evaluate</b> regex to match
1313         expressions that should be evaluated without insertion into the resulting
1314         string. You may define or omit any combination of the three.
1315         For example, to perform
1316         <a href="http://github.com/janl/mustache.js#readme">Mustache.js</a>
1317         style templating:
1318       </p>
1319
1320       <pre>
1321 _.templateSettings = {
1322   interpolate : /\{\{(.+?)\}\}/g
1323 };
1324
1325 var template = _.template("Hello {{ name }}!");
1326 template({name : "Mustache"});
1327 =&gt; "Hello Mustache!"</pre>
1328
1329
1330       <h2 id="chaining">Chaining</h2>
1331
1332       <p>
1333         You can use Underscore in either an object-oriented or a functional style,
1334         depending on your preference. The following two lines of code are
1335         identical ways to double a list of numbers.
1336       </p>
1337
1338     <pre>
1339 _.map([1, 2, 3], function(n){ return n * 2; });
1340 _([1, 2, 3]).map(function(n){ return n * 2; });</pre>
1341
1342       <p>
1343         Using the object-oriented style allows you to chain together methods. Calling
1344         <tt>chain</tt> on a wrapped object will cause all future method calls to
1345         return wrapped objects as well. When you've finished the computation,
1346         use <tt>value</tt> to retrieve the final value. Here's an example of chaining
1347         together a <b>map/flatten/reduce</b>, in order to get the word count of
1348         every word in a song.
1349       </p>
1350
1351 <pre>
1352 var lyrics = [
1353   {line : 1, words : "I'm a lumberjack and I'm okay"},
1354   {line : 2, words : "I sleep all night and I work all day"},
1355   {line : 3, words : "He's a lumberjack and he's okay"},
1356   {line : 4, words : "He sleeps all night and he works all day"}
1357 ];
1358
1359 _.chain(lyrics)
1360   .map(function(line) { return line.words.split(' '); })
1361   .flatten()
1362   .reduce(function(counts, word) {
1363     counts[word] = (counts[word] || 0) + 1;
1364     return counts;
1365 }, {}).value();
1366
1367 =&gt; {lumberjack : 2, all : 4, night : 2 ... }</pre>
1368
1369       <p>
1370         In addition, the
1371         <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/prototype">Array prototype's methods</a>
1372         are proxied through the chained Underscore object, so you can slip a
1373         <tt>reverse</tt> or a <tt>push</tt> into your chain, and continue to
1374         modify the array.
1375       </p>
1376
1377       <p id="chain">
1378         <b class="header">chain</b><code>_.chain(obj)</code>
1379         <br />
1380         Returns a wrapped object. Calling methods on this object will continue
1381         to return wrapped objects until <tt>value</tt> is used.
1382       </p>
1383       <pre>
1384 var stooges = [{name : 'curly', age : 25}, {name : 'moe', age : 21}, {name : 'larry', age : 23}];
1385 var youngest = _.chain(stooges)
1386   .sortBy(function(stooge){ return stooge.age; })
1387   .map(function(stooge){ return stooge.name + ' is ' + stooge.age; })
1388   .first()
1389   .value();
1390 =&gt; "moe is 21"
1391 </pre>
1392
1393       <p id="value">
1394         <b class="header">value</b><code>_(obj).value()</code>
1395         <br />
1396         Extracts the value of a wrapped object.
1397       </p>
1398       <pre>
1399 _([1, 2, 3]).value();
1400 =&gt; [1, 2, 3]
1401 </pre>
1402
1403       <h2 id="links">Links &amp; Suggested Reading</h2>
1404
1405       <p>
1406         <a href="http://mirven.github.com/underscore.lua/">Underscore.lua</a>,
1407         a Lua port of the functions that are applicable in both languages.
1408         Includes OOP-wrapping and chaining.
1409         The <a href="http://github.com/mirven/underscore.lua">source</a> is
1410         available on GitHub.
1411       </p>
1412       
1413       <p>
1414         <a href="http://brianhaveri.github.com/Underscore.php/">Underscore.php</a>,
1415         a PHP port of the functions that are applicable in both languages.
1416         Includes OOP-wrapping and chaining.
1417         The <a href="http://github.com/brianhaveri/Underscore.php">source</a> is
1418         available on GitHub.
1419       </p>
1420       
1421       <p>
1422         <a href="http://vti.github.com/underscore-perl/">Underscore-perl</a>,
1423         a Perl port of many of the Underscore.js functions, 
1424         aimed at on Perl hashes and arrays, also 
1425         <a href="https://github.com/vti/underscore-perl/">available on GitHub</a>.
1426       </p>
1427       
1428       <p>
1429         <a href="https://github.com/edtsech/underscore.string">Underscore.string</a>,
1430         an Underscore extension that adds functions for string-manipulation: 
1431         <tt>trim</tt>, <tt>startsWith</tt>, <tt>contains</tt>, <tt>capitalize</tt>,
1432         <tt>reverse</tt>, <tt>sprintf</tt>, and more.
1433       </p>
1434
1435       <p>
1436         Ruby's <a href="http://ruby-doc.org/core/classes/Enumerable.html">Enumerable</a> module.
1437       </p>
1438
1439       <p>
1440         <a href="http://www.prototypejs.org/">Prototype.js</a>, which provides
1441         JavaScript with collection functions in the manner closest to Ruby's Enumerable.
1442       </p>
1443
1444       <p>
1445         Oliver Steele's
1446         <a href="http://osteele.com/sources/javascript/functional/">Functional JavaScript</a>,
1447         which includes comprehensive higher-order function support as well as string lambdas.
1448       </p>
1449       
1450       <p>
1451         Michael Aufreiter's <a href="http://substance.io/#michael/data-js">Data.js</a>,
1452         a data manipulation + persistence library for JavaScript.
1453       </p>
1454
1455       <p>
1456         Python's <a href="http://docs.python.org/library/itertools.html">itertools</a>.
1457       </p>
1458
1459       <h2 id="changelog">Change Log</h2>
1460       
1461       <p>
1462         <b class="header">1.2.4</b> &mdash; <small><i>Jan. 4, 2012</i></small><br />
1463         <ul>
1464           <li>
1465             You now can (and probably should) write <tt>_.chain(list)</tt> 
1466             instead of <tt>_(list).chain()</tt>.
1467           </li>
1468           <li>
1469             Fix for escaped characters in Underscore templates, and for supporting
1470             customizations of <tt>_.templateSettings</tt> that only define one or
1471             two of the required regexes.
1472           </li>
1473           <li>
1474             Fix for passing an array as the first argument to an <tt>_.wrap</tt>'d function.
1475           </li>
1476           <li>
1477             Improved compatibility with ClojureScript, which adds a <tt>call</tt>
1478             function to <tt>String.prototype</tt>.
1479           </li>
1480         </ul>
1481       </p>
1482       
1483       <p>
1484         <b class="header">1.2.3</b> &mdash; <small><i>Dec. 7, 2011</i></small><br />
1485         <ul>
1486           <li>
1487             Dynamic scope is now preserved for compiled <tt>_.template</tt> functions,
1488             so you can use the value of <tt>this</tt> if you like.
1489           </li>
1490           <li>
1491             Sparse array support of <tt>_.indexOf</tt>, <tt>_.lastIndexOf</tt>.
1492           </li>
1493           <li>
1494             Both <tt>_.reduce</tt> and <tt>_.reduceRight</tt> can now be passed an
1495             explicitly <tt>undefined</tt> value. (There's no reason why you'd 
1496             want to do this.)
1497           </li>
1498         </ul>
1499       </p>
1500       
1501       <p>
1502         <b class="header">1.2.2</b> &mdash; <small><i>Nov. 14, 2011</i></small><br />
1503         <ul>
1504           <li>
1505             Continued tweaks to <tt>_.isEqual</tt> semantics. Now JS primitives are
1506             considered equivalent to their wrapped versions, and arrays are compared
1507             by their numeric properties only <small>(#351)</small>.
1508           </li>
1509           <li>
1510             <tt>_.escape</tt> no longer tries to be smart about not double-escaping
1511             already-escaped HTML entities. Now it just escapes regardless <small>(#350)</small>.
1512           </li>
1513           <li>
1514             In <tt>_.template</tt>, you may now leave semicolons out of evaluated
1515             statements if you wish: <tt>&lt;% }) %&gt;</tt> <small>(#369)</small>.
1516           </li>
1517           <li>
1518             <tt>_.after(callback, 0)</tt> will now trigger the callback immediately,
1519             making "after" easier to use with asynchronous APIs <small>(#366)</small>. 
1520           </li>
1521         </ul>
1522       </p>
1523       
1524       <p>
1525         <b class="header">1.2.1</b> &mdash; <small><i>Oct. 24, 2011</i></small><br />
1526         <ul>
1527           <li>
1528             Several important bug fixes for <tt>_.isEqual</tt>, which should now 
1529             do better on mutated Arrays, and on non-Array objects with 
1530             <tt>length</tt> properties. <small>(#329)</small>
1531           </li>
1532           <li>
1533             <b>jrburke</b> contributed Underscore exporting for AMD module loaders,
1534             and <b>tonylukasavage</b> for Appcelerator Titanium. 
1535             <small>(#335, #338)</small>
1536           </li>
1537           <li>
1538             You can now <tt>_.groupBy(list, 'property')</tt> as a shortcut for
1539             grouping values by a particular common property.
1540           </li>
1541           <li>
1542             <tt>_.throttle</tt>'d functions now fire immediately upon invocation, 
1543             and are rate-limited thereafter <small>(#170, #266)</small>.
1544           </li>
1545           <li>
1546             Most of the <tt>_.is[Type]</tt> checks no longer ducktype.
1547           </li>
1548           <li>
1549             The <tt>_.bind</tt> function now also works on constructors, a-la
1550             ES5 ... but you would never want to use <tt>_.bind</tt> on a 
1551             constructor function.
1552           </li>
1553           <li>
1554             <tt>_.clone</tt> no longer wraps non-object types in Objects.
1555           </li>
1556           <li>
1557             <tt>_.find</tt> and <tt>_.filter</tt> are now the preferred names for
1558             <tt>_.detect</tt> and <tt>_.select</tt>.
1559           </li>
1560         </ul>
1561       </p>
1562       
1563       <p>
1564         <b class="header">1.2.0</b> &mdash; <small><i>Oct. 5, 2011</i></small><br />
1565         <ul>
1566           <li>
1567             The <tt>_.isEqual</tt> function now 
1568             supports true deep equality comparisons, with checks for cyclic structures,
1569             thanks to Kit Cambridge.
1570           </li>
1571           <li>
1572             Underscore templates now support HTML escaping interpolations, using 
1573             <tt>&lt;%- ... %&gt;</tt> syntax. 
1574           </li>
1575           <li>
1576             Ryan Tenney contributed <tt>_.shuffle</tt>, which uses a modified 
1577             Fisher-Yates to give you a shuffled copy of an array. 
1578           </li>
1579           <li>
1580             <tt>_.uniq</tt> can now be passed an optional iterator, to determine by 
1581             what criteria an object should be considered unique.
1582           </li>
1583           <li>
1584             <tt>_.last</tt> now takes an optional argument which will return the last
1585             N elements of the list.
1586           </li>
1587           <li>
1588             A new <tt>_.initial</tt> function was added, as a mirror of <tt>_.rest</tt>,
1589             which returns all the initial values of a list (except the last N). 
1590           </li>
1591         </ul>
1592       </p>
1593       
1594       <p>
1595         <b class="header">1.1.7</b> &mdash; <small><i>July 13, 2011</i></small><br />
1596         Added <tt>_.groupBy</tt>, which aggregates a collection into groups of like items.
1597         Added <tt>_.union</tt> and <tt>_.difference</tt>, to complement the 
1598         (re-named) <tt>_.intersection</tt>.
1599         Various improvements for support of sparse arrays.
1600         <tt>_.toArray</tt> now returns a clone, if directly passed an array.
1601         <tt>_.functions</tt> now also returns the names of functions that are present
1602         in the prototype chain.
1603       </p>
1604             
1605       <p>
1606         <b class="header">1.1.6</b> &mdash; <small><i>April 18, 2011</i></small><br />
1607         Added <tt>_.after</tt>, which will return a function that only runs after
1608         first being called a specified number of times.
1609         <tt>_.invoke</tt> can now take a direct function reference.
1610         <tt>_.every</tt> now requires an iterator function to be passed, which
1611         mirrors the ECMA5 API.
1612         <tt>_.extend</tt> no longer copies keys when the value is undefined.
1613         <tt>_.bind</tt> now errors when trying to bind an undefined value.
1614       </p>
1615       
1616       <p>
1617         <b class="header">1.1.5</b> &mdash; <small><i>Mar 20, 2011</i></small><br />
1618         Added an <tt>_.defaults</tt> function, for use merging together JS objects
1619         representing default options.
1620         Added an <tt>_.once</tt> function, for manufacturing functions that should
1621         only ever execute a single time.
1622         <tt>_.bind</tt> now delegates to the native ECMAScript 5 version, 
1623         where available.
1624         <tt>_.keys</tt> now throws an error when used on non-Object values, as in
1625         ECMAScript 5.
1626         Fixed a bug with <tt>_.keys</tt> when used over sparse arrays.
1627       </p>
1628       
1629       <p>
1630         <b class="header">1.1.4</b> &mdash; <small><i>Jan 9, 2011</i></small><br />
1631         Improved compliance with ES5's Array methods when passing <tt>null</tt> 
1632         as a value. <tt>_.wrap</tt> now correctly sets <tt>this</tt> for the
1633         wrapped function. <tt>_.indexOf</tt> now takes an optional flag for
1634         finding the insertion index in an array that is guaranteed to already
1635         be sorted. Avoiding the use of <tt>.callee</tt>, to allow <tt>_.isArray</tt>
1636         to work properly in ES5's strict mode.
1637       </p>
1638       
1639       <p>
1640         <b class="header">1.1.3</b> &mdash; <small><i>Dec 1, 2010</i></small><br />
1641         In CommonJS, Underscore may now be required with just: <br />
1642         <tt>var _ = require("underscore")</tt>.
1643         Added <tt>_.throttle</tt> and <tt>_.debounce</tt> functions.
1644         Removed <tt>_.breakLoop</tt>, in favor of an ECMA5-style un-<i>break</i>-able
1645         each implementation &mdash; this removes the try/catch, and you'll now have
1646         better stack traces for exceptions that are thrown within an Underscore iterator.
1647         Improved the <b>isType</b> family of functions for better interoperability
1648         with Internet Explorer host objects.
1649         <tt>_.template</tt> now correctly escapes backslashes in templates.
1650         Improved <tt>_.reduce</tt> compatibility with the ECMA5 version: 
1651         if you don't pass an initial value, the first item in the collection is used.
1652         <tt>_.each</tt> no longer returns the iterated collection, for improved
1653         consistency with ES5's <tt>forEach</tt>.
1654       </p>
1655       
1656       <p>
1657         <b class="header">1.1.2</b><br />
1658         Fixed <tt>_.contains</tt>, which was mistakenly pointing at 
1659         <tt>_.intersect</tt> instead of <tt>_.include</tt>, like it should 
1660         have been. Added <tt>_.unique</tt> as an alias for <tt>_.uniq</tt>.
1661       </p>
1662       
1663       <p>
1664         <b class="header">1.1.1</b><br />
1665         Improved the speed of <tt>_.template</tt>, and its handling of multiline
1666         interpolations. Ryan Tenney contributed optimizations to many Underscore 
1667         functions. An annotated version of the source code is now available.
1668       </p>
1669       
1670       <p>
1671         <b class="header">1.1.0</b><br />
1672         The method signature of <tt>_.reduce</tt> has been changed to match
1673         the ECMAScript 5 signature, instead of the Ruby/Prototype.js version.
1674         This is a backwards-incompatible change. <tt>_.template</tt> may now be
1675         called with no arguments, and preserves whitespace. <tt>_.contains</tt>
1676         is a new alias for <tt>_.include</tt>.
1677       </p>
1678       
1679       <p>
1680         <b class="header">1.0.4</b><br />
1681         <a href="http://themoell.com/">Andri Möll</a> contributed the <tt>_.memoize</tt> 
1682         function, which can be used to speed up expensive repeated computations 
1683         by caching the results.
1684       </p>
1685       
1686       <p>
1687         <b class="header">1.0.3</b><br />
1688         Patch that makes <tt>_.isEqual</tt> return <tt>false</tt> if any property
1689         of the compared object has a <tt>NaN</tt> value. Technically the correct
1690         thing to do, but of questionable semantics. Watch out for NaN comparisons.
1691       </p>
1692       
1693       <p>
1694         <b class="header">1.0.2</b><br />
1695         Fixes <tt>_.isArguments</tt> in recent versions of Opera, which have
1696         arguments objects as real Arrays.
1697       </p>
1698       
1699       <p>
1700         <b class="header">1.0.1</b><br />
1701         Bugfix for <tt>_.isEqual</tt>, when comparing two objects with the same 
1702         number of undefined keys, but with different names.
1703       </p>
1704       
1705       <p>
1706         <b class="header">1.0.0</b><br />
1707         Things have been stable for many months now, so Underscore is now
1708         considered to be out of beta, at <b>1.0</b>. Improvements since <b>0.6</b>
1709         include <tt>_.isBoolean</tt>, and the ability to have <tt>_.extend</tt>
1710         take multiple source objects.
1711       </p>
1712       
1713       <p>
1714         <b class="header">0.6.0</b><br />
1715         Major release. Incorporates a number of 
1716         <a href="http://github.com/ratbeard">Mile Frawley's</a> refactors for
1717         safer duck-typing on collection functions, and cleaner internals. A new
1718         <tt>_.mixin</tt> method that allows you to extend Underscore with utility
1719         functions of your own. Added <tt>_.times</tt>, which works the same as in 
1720         Ruby or Prototype.js. Native support for ECMAScript 5's <tt>Array.isArray</tt>, 
1721         and <tt>Object.keys</tt>.
1722       </p>
1723
1724       <p>
1725         <b class="header">0.5.8</b><br />
1726         Fixed Underscore's collection functions to work on
1727         <a href="https://developer.mozilla.org/En/DOM/NodeList">NodeLists</a> and
1728         <a href="https://developer.mozilla.org/En/DOM/HTMLCollection">HTMLCollections</a>
1729         once more, thanks to
1730         <a href="http://github.com/jmtulloss">Justin Tulloss</a>.
1731       </p>
1732
1733       <p>
1734         <b class="header">0.5.7</b><br />
1735         A safer implementation of <tt>_.isArguments</tt>, and a
1736         faster <tt>_.isNumber</tt>,<br />thanks to
1737         <a href="http://jedschmidt.com/">Jed Schmidt</a>.
1738       </p>
1739
1740       <p>
1741         <b class="header">0.5.6</b><br />
1742         Customizable delimiters for <tt>_.template</tt>, contributed by
1743         <a href="http://github.com/iamnoah">Noah Sloan</a>.
1744       </p>
1745
1746       <p>
1747         <b class="header">0.5.5</b><br />
1748         Fix for a bug in MobileSafari's OOP-wrapper, with the arguments object.
1749       </p>
1750
1751       <p>
1752         <b class="header">0.5.4</b><br />
1753         Fix for multiple single quotes within a template string for
1754         <tt>_.template</tt>. See:
1755         <a href="http://www.west-wind.com/Weblog/posts/509108.aspx">Rick Strahl's blog post</a>.
1756       </p>
1757
1758       <p>
1759         <b class="header">0.5.2</b><br />
1760         New implementations of <tt>isArray</tt>, <tt>isDate</tt>, <tt>isFunction</tt>,
1761         <tt>isNumber</tt>, <tt>isRegExp</tt>, and <tt>isString</tt>, thanks to
1762         a suggestion from
1763         <a href="http://www.broofa.com/">Robert Kieffer</a>.
1764         Instead of doing <tt>Object#toString</tt>
1765         comparisons, they now check for expected properties, which is less safe,
1766         but more than an order of magnitude faster. Most other Underscore
1767         functions saw minor speed improvements as a result.
1768         <a href="http://dolzhenko.org/">Evgeniy Dolzhenko</a>
1769         contributed <tt>_.tap</tt>,
1770         <a href="http://ruby-doc.org/core-1.9/classes/Object.html#M000191">similar to Ruby 1.9's</a>,
1771         which is handy for injecting side effects (like logging) into chained calls.
1772       </p>
1773
1774       <p>
1775         <b class="header">0.5.1</b><br />
1776         Added an <tt>_.isArguments</tt> function. Lots of little safety checks
1777         and optimizations contributed by
1778         <a href="http://github.com/iamnoah/">Noah Sloan</a> and 
1779         <a href="http://themoell.com/">Andri Möll</a>.
1780       </p>
1781
1782       <p>
1783         <b class="header">0.5.0</b><br />
1784         <b>[API Changes]</b> <tt>_.bindAll</tt> now takes the context object as
1785         its first parameter. If no method names are passed, all of the context
1786         object's methods are bound to it, enabling chaining and easier binding.
1787         <tt>_.functions</tt> now takes a single argument and returns the names
1788         of its Function properties. Calling <tt>_.functions(_)</tt> will get you
1789         the previous behavior.
1790         Added <tt>_.isRegExp</tt> so that <tt>isEqual</tt> can now test for RegExp equality.
1791         All of the "is" functions have been shrunk down into a single definition.
1792         <a href="http://github.com/grayrest/">Karl Guertin</a> contributed patches.
1793       </p>
1794
1795       <p>
1796         <b class="header">0.4.7</b><br />
1797         Added <tt>isDate</tt>, <tt>isNaN</tt>, and <tt>isNull</tt>, for completeness.
1798         Optimizations for <tt>isEqual</tt> when checking equality between Arrays
1799         or Dates. <tt>_.keys</tt> is now <small><i><b>25%&ndash;2X</b></i></small> faster (depending on your
1800         browser) which speeds up the functions that rely on it, such as <tt>_.each</tt>.
1801       </p>
1802
1803       <p>
1804         <b class="header">0.4.6</b><br />
1805         Added the <tt>range</tt> function, a port of the
1806         <a href="http://docs.python.org/library/functions.html#range">Python
1807         function of the same name</a>, for generating flexibly-numbered lists
1808         of integers. Original patch contributed by
1809         <a href="http://github.com/kylichuku">Kirill Ishanov</a>.
1810       </p>
1811
1812       <p>
1813         <b class="header">0.4.5</b><br />
1814         Added <tt>rest</tt> for Arrays and arguments objects, and aliased
1815         <tt>first</tt> as <tt>head</tt>, and <tt>rest</tt> as <tt>tail</tt>,
1816         thanks to <a href="http://github.com/lukesutton/">Luke Sutton</a>'s patches.
1817         Added tests ensuring that all Underscore Array functions also work on
1818         <i>arguments</i> objects.
1819       </p>
1820
1821       <p>
1822         <b class="header">0.4.4</b><br />
1823         Added <tt>isString</tt>, and <tt>isNumber</tt>, for consistency. Fixed
1824         <tt>_.isEqual(NaN, NaN)</tt> to return <i>true</i> (which is debatable).
1825       </p>
1826
1827       <p>
1828         <b class="header">0.4.3</b><br />
1829         Started using the native <tt>StopIteration</tt> object in browsers that support it.
1830         Fixed Underscore setup for CommonJS environments.
1831       </p>
1832
1833       <p>
1834         <b class="header">0.4.2</b><br />
1835         Renamed the unwrapping function to <tt>value</tt>, for clarity.
1836       </p>
1837
1838       <p>
1839         <b class="header">0.4.1</b><br />
1840         Chained Underscore objects now support the Array prototype methods, so
1841         that you can perform the full range of operations on a wrapped array
1842         without having to break your chain. Added a <tt>breakLoop</tt> method
1843         to <b>break</b> in the middle of any Underscore iteration. Added an
1844         <tt>isEmpty</tt> function that works on arrays and objects.
1845       </p>
1846
1847       <p>
1848         <b class="header">0.4.0</b><br />
1849         All Underscore functions can now be called in an object-oriented style,
1850         like so: <tt>_([1, 2, 3]).map(...);</tt>. Original patch provided by
1851         <a href="http://macournoyer.com/">Marc-André Cournoyer</a>.
1852         Wrapped objects can be chained through multiple
1853         method invocations. A <a href="#functions"><tt>functions</tt></a> method
1854         was added, providing a sorted list of all the functions in Underscore.
1855       </p>
1856
1857       <p>
1858         <b class="header">0.3.3</b><br />
1859         Added the JavaScript 1.8 function <tt>reduceRight</tt>. Aliased it
1860         as <tt>foldr</tt>, and aliased <tt>reduce</tt> as <tt>foldl</tt>.
1861       </p>
1862
1863       <p>
1864         <b class="header">0.3.2</b><br />
1865         Now runs on stock <a href="http://www.mozilla.org/rhino/">Rhino</a>
1866         interpreters with: <tt>load("underscore.js")</tt>.
1867         Added <a href="#identity"><tt>identity</tt></a> as a utility function.
1868       </p>
1869
1870       <p>
1871         <b class="header">0.3.1</b><br />
1872         All iterators are now passed in the original collection as their third
1873         argument, the same as JavaScript 1.6's <b>forEach</b>. Iterating over
1874         objects is now called with <tt>(value, key, collection)</tt>, for details
1875         see <a href="#each"><tt>_.each</tt></a>.
1876       </p>
1877
1878       <p>
1879         <b class="header">0.3.0</b><br />
1880         Added <a href="http://github.com/dmitryBaranovskiy">Dmitry Baranovskiy</a>'s
1881         comprehensive optimizations, merged in
1882         <a href="http://github.com/kriskowal/">Kris Kowal</a>'s patches to make Underscore
1883         <a href="http://wiki.commonjs.org/wiki/CommonJS">CommonJS</a> and
1884         <a href="http://narwhaljs.org/">Narwhal</a> compliant.
1885       </p>
1886
1887       <p>
1888         <b class="header">0.2.0</b><br />
1889         Added <tt>compose</tt> and <tt>lastIndexOf</tt>, renamed <tt>inject</tt> to
1890         <tt>reduce</tt>, added aliases for <tt>inject</tt>, <tt>filter</tt>,
1891         <tt>every</tt>, <tt>some</tt>, and <tt>forEach</tt>.
1892       </p>
1893
1894       <p>
1895         <b class="header">0.1.1</b><br />
1896         Added <tt>noConflict</tt>, so that the "Underscore" object can be assigned to
1897         other variables.
1898       </p>
1899
1900       <p>
1901         <b class="header">0.1.0</b><br />
1902         Initial release of Underscore.js.
1903       </p>
1904
1905       <p>
1906         <a href="http://documentcloud.org/" title="A DocumentCloud Project" style="background:none;">
1907           <img src="http://jashkenas.s3.amazonaws.com/images/a_documentcloud_project.png" alt="A DocumentCloud Project" />
1908         </a>
1909       </p>
1910
1911     </div>
1912
1913   </div>
1914
1915   <!-- Include Underscore, so you can play with it in the console. -->
1916   <script type="text/javascript" src="underscore.js"></script>
1917
1918 </body>
1919 </html>