Skip to content

Commit

Permalink
Fix jashkenas#834 - Provide documentation for _.unescape.
Browse files Browse the repository at this point in the history
  • Loading branch information
braddunbar committed Oct 21, 2012
1 parent 6dc54a5 commit a16d61e
Showing 1 changed file with 31 additions and 20 deletions.
51 changes: 31 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
<li>- <a href="#mixin">mixin</a></li>
<li>- <a href="#uniqueId">uniqueId</a></li>
<li>- <a href="#escape">escape</a></li>
<li>- <a href="#unescape">unescape</a></li>
<li>- <a href="#result">result</a></li>
<li>- <a href="#template">template</a></li>
</ul>
Expand Down Expand Up @@ -627,12 +628,12 @@ <h2 id="collections">Collection Functions (Arrays or Objects)</h2>
<br />
Sorts a list into groups and returns a count for the number of objects
in each group.
Similar to <tt>groupBy</tt>, but instead of returning a list of values,
Similar to <tt>groupBy</tt>, but instead of returning a list of values,
returns a count for the number of values in that group.
</p>
<pre>
_.countBy([1, 2, 3, 4, 5], function(num) {
return num % 2 == 0 ? 'even' : 'odd';
_.countBy([1, 2, 3, 4, 5], function(num) {
return num % 2 == 0 ? 'even' : 'odd';
});
=&gt; {odd: 3, even: 2}
</pre>
Expand Down Expand Up @@ -827,7 +828,7 @@ <h2 id="arrays">Array Functions</h2>
<p id="object">
<b class="header">object</b><code>_.object(list, [values])</code>
<br />
Converts arrays into objects. Pass either a single list of
Converts arrays into objects. Pass either a single list of
<tt>[key, value]</tt> pairs, or a list of keys, and a list of values.
</p>
<pre>
Expand All @@ -845,8 +846,8 @@ <h2 id="arrays">Array Functions</h2>
or <i>-1</i> if value is not present in the <b>array</b>. Uses the native
<b>indexOf</b> function unless it's missing. If you're working with a
large array, and you know that the array is already sorted, pass <tt>true</tt>
for <b>isSorted</b> to use a faster binary search ... or, pass a number as
the third argument in order to look for the first matching value in the
for <b>isSorted</b> to use a faster binary search ... or, pass a number as
the third argument in order to look for the first matching value in the
array after the given index.
</p>
<pre>
Expand All @@ -859,7 +860,7 @@ <h2 id="arrays">Array Functions</h2>
<br />
Returns the index of the last occurrence of <b>value</b> in the <b>array</b>,
or <i>-1</i> if value is not present. Uses the native <b>lastIndexOf</b>
function if possible. Pass <b>fromIndex</b> to start your search at a
function if possible. Pass <b>fromIndex</b> to start your search at a
given index.
</p>
<pre>
Expand Down Expand Up @@ -1122,7 +1123,7 @@ <h2 id="objects">Object Functions</h2>
<b class="header">invert</b><code>_.invert(object)</code>
<br />
Returns a copy of the <b>object</b> where the keys have become the values
and the values the keys. For this to work, all of your object's values
and the values the keys. For this to work, all of your object's values
should be unique and string serializable.
</p>
<pre>
Expand Down Expand Up @@ -1442,7 +1443,7 @@ <h2 id="utility">Utility Functions</h2>
<p id="times">
<b class="header">times</b><code>_.times(n, iterator, [context])</code>
<br />
Invokes the given iterator function <b>n</b> times. Each invocation of
Invokes the given iterator function <b>n</b> times. Each invocation of
<b>iterator</b> is called with an <tt>index</tt> argument.
<br />
<i>Note: this example uses the <a href="#chaining">chaining syntax</a></i>.
Expand Down Expand Up @@ -1499,6 +1500,16 @@ <h2 id="utility">Utility Functions</h2>
_.escape('Curly, Larry &amp; Moe');
=&gt; "Curly, Larry &amp;amp; Moe"</pre>

<p id="unescape">
<b class="header">unescape</b><code>_.unescape(string)</code>
<br />
The opposite of <a href="#escape"><b>escape</b></a>, replaces escaped
HTML entities with with their unescaped counterparts.
</p>
<pre>
_.escape('Curly, Larry &amp;amp; Moe');
=&gt; "Curly, Larry &amp; Moe"</pre>

<p id="result">
<b class="header">result</b><code>_.result(object, property)</code>
<br />
Expand Down Expand Up @@ -1748,18 +1759,18 @@ <h2 id="links">Links &amp; Suggested Reading</h2>
</p>

<h2 id="changelog">Change Log</h2>

<p>
<b class="header">1.4.2</b> &mdash; <small><i>Oct. 1, 2012</i></small> &mdash; <a href="https://github.com/documentcloud/underscore/compare/1.4.1...1.4.2">Diff</a><br />
<ul>
<li>
For backwards compatibility, returned to pre-1.4.0 behavior when
passing <tt>null</tt> to iteration functions. They now become no-ops
For backwards compatibility, returned to pre-1.4.0 behavior when
passing <tt>null</tt> to iteration functions. They now become no-ops
again.
</li>
</ul>
</p>

<p>
<b class="header">1.4.1</b> &mdash; <small><i>Oct. 1, 2012</i></small> &mdash; <a href="https://github.com/documentcloud/underscore/compare/1.4.0...1.4.1">Diff</a><br />
<ul>
Expand All @@ -1768,22 +1779,22 @@ <h2 id="changelog">Change Log</h2>
</li>
</ul>
</p>

<p>
<b class="header">1.4.0</b> &mdash; <small><i>Sept. 27, 2012</i></small> &mdash; <a href="https://github.com/documentcloud/underscore/compare/1.3.3...1.4.0">Diff</a><br />
<ul>
<li>
Added a <tt>pairs</tt> function, for turning a JavaScript object
into <tt>[key, value]</tt> pairs ... as well as an <tt>object</tt>
function, for converting an array of <tt>[key, value]</tt> pairs
Added a <tt>pairs</tt> function, for turning a JavaScript object
into <tt>[key, value]</tt> pairs ... as well as an <tt>object</tt>
function, for converting an array of <tt>[key, value]</tt> pairs
into an object.
</li>
<li>
Added a <tt>countBy</tt> function, for counting the number of objects
in a list that match a certain criteria.
</li>
<li>
Added an <tt>invert</tt> function, for performing a simple inversion
Added an <tt>invert</tt> function, for performing a simple inversion
of the keys and values in an object.
</li>
<li>
Expand Down Expand Up @@ -1814,11 +1825,11 @@ <h2 id="changelog">Change Log</h2>
functions. Use a <tt>for</tt> loop instead (or better yet, an object).
</li>
<li>
The <tt>min</tt> and <tt>max</tt> functions may now be called on
The <tt>min</tt> and <tt>max</tt> functions may now be called on
<i>very</i> large arrays.
</li>
<li>
Interpolation in templates now represents <tt>null</tt> and
Interpolation in templates now represents <tt>null</tt> and
<tt>undefined</tt> as the empty string.
</li>
<li>
Expand Down

0 comments on commit a16d61e

Please sign in to comment.