Skip to content

Commit

Permalink
Underscore.js 1.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Jan 30, 2013
1 parent 789da94 commit 484bdb4
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 150 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009-2012 Jeremy Ashkenas, DocumentCloud
Copyright (c) 2009-2013 Jeremy Ashkenas, DocumentCloud

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand All @@ -19,4 +19,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
OTHER DEALINGS IN THE SOFTWARE.
Binary file modified docs/images/underscore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
266 changes: 134 additions & 132 deletions docs/underscore.html

Large diffs are not rendered by default.

64 changes: 60 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
<div id="sidebar" class="interface">

<a class="toc_title" href="#">
Underscore.js <span class="version">(1.4.3)</span>
Underscore.js <span class="version">(1.4.4)</span>
</a>
<ul class="toc_section">
<li>&raquo; <a href="http://github.com/documentcloud/underscore">GitHub Repository</a></li>
Expand All @@ -201,6 +201,7 @@
<li>- <a href="#find">find</a></li>
<li>- <a href="#filter">filter</a></li>
<li>- <a href="#where">where</a></li>
<li>- <a href="#findWhere">findWhere</a></li>
<li>- <a href="#reject">reject</a></li>
<li>- <a href="#every">every</a></li>
<li>- <a href="#some">some</a></li>
Expand Down Expand Up @@ -246,6 +247,7 @@
<ul class="toc_section">
<li>- <a href="#bind">bind</a></li>
<li>- <a href="#bindAll">bindAll</a></li>
<li>- <a href="#partial">partial</a></li>
<li>- <a href="#memoize">memoize</a></li>
<li>- <a href="#delay">delay</a></li>
<li>- <a href="#defer">defer</a></li>
Expand Down Expand Up @@ -378,11 +380,11 @@ <h2>Downloads <i style="padding-left: 12px; font-size:12px;">(Right-click, and u

<table>
<tr>
<td><a href="underscore.js">Development Version (1.4.3)</a></td>
<td><a href="underscore.js">Development Version (1.4.4)</a></td>
<td><i>40kb, Uncompressed with Plentiful Comments</i></td>
</tr>
<tr>
<td><a href="underscore-min.js">Production Version (1.4.3)</a></td>
<td><a href="underscore-min.js">Production Version (1.4.4)</a></td>
<td><i>4kb, Minified and Gzipped</i></td>
</tr>
<tr>
Expand Down Expand Up @@ -500,6 +502,20 @@ <h2 id="collections">Collection Functions (Arrays or Objects)</h2>
{title: "The Tempest", author: "Shakespeare", year: 1611}]
</pre>

<p id="findWhere">
<b class="header">findWhere</b><code>_.findWhere(list, properties)</code>
<br />
Looks through the <b>list</b> and returns the <i>first</i> value that matches
all of the key-value pairs listed in <b>properties</b>.
</p>
<pre>
_.findWhere(publicServicePulitzers, {newsroom: "The New York Times"});
=&gt; {year: 1918, newsroom: "The New York Times",
reason: "For its public service in publishing in full so many official reports,
documents and speeches by European statesmen relating to the progress and
conduct of the war."}
</pre>

<p id="reject">
<b class="header">reject</b><code>_.reject(list, iterator, [context])</code>
<br />
Expand Down Expand Up @@ -914,7 +930,7 @@ <h2 id="functions">Function (uh, ahem) Functions</h2>
<br />
Bind a <b>function</b> to an <b>object</b>, meaning that whenever
the function is called, the value of <i>this</i> will be the <b>object</b>.
Optionally, bind <b>arguments</b> to the <b>function</b> to pre-fill them,
Optionally, pass <b>arguments</b> to the <b>function</b> to pre-fill them,
also known as <b>partial application</b>.
</p>
<pre>
Expand Down Expand Up @@ -943,6 +959,20 @@ <h2 id="functions">Function (uh, ahem) Functions</h2>
_.bindAll(buttonView);
jQuery('#underscore_button').bind('click', buttonView.onClick);
=&gt; When the button is clicked, this.label will have the correct value...
</pre>

<p id="partial">
<b class="header">partial</b><code>_.partial(function, [*arguments])</code>
<br />
Partially apply a function by filling in any number of its arguments,
<i>without</i> changing its dynamic <tt>this</tt> value. A close cousin
of <a href="#bind">bind</a>.
</p>
<pre>
var add = function(a, b) { return a + b; };
add5 = _.partial(add, 5);
add5(10);
=&gt; 15
</pre>

<p id="memoize">
Expand Down Expand Up @@ -1766,6 +1796,32 @@ <h2 id="links">Links &amp; Suggested Reading</h2>

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

<p>
<b class="header">1.4.4</b> &mdash; <small><i>Jan. 30, 2013</i></small> &mdash; <a href="https://github.com/documentcloud/underscore/compare/1.4.3...1.4.4">Diff</a><br />
<ul>
<li>
Added <tt>_.findWhere</tt>, for finding the first element in a list
that matches a particular set of keys and values.
</li>
<li>
Added <tt>_.partial</tt>, for partially applying a function <i>without</i>
changing its dynamic reference to <tt>this</tt>.
</li>
<li>
Simplified <tt>bind</tt> by removing some edge cases involving
constructor functions. In short: don't <tt>_.bind</tt> your
constructors.
</li>
<li>
A minor optimization to <tt>invoke</tt>.
</li>
<li>
Fix bug in the minified version due to the minifier incorrectly
optimizing-away <tt>isFunction</tt>.
</li>
</ul>
</p>

<p>
<b class="header">1.4.3</b> &mdash; <small><i>Dec. 4, 2012</i></small> &mdash; <a href="https://github.com/documentcloud/underscore/compare/1.4.2...1.4.3">Diff</a><br />
<ul>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author" : "Jeremy Ashkenas <[email protected]>",
"repository" : {"type": "git", "url": "git://github.com/documentcloud/underscore.git"},
"main" : "underscore.js",
"version" : "1.4.3",
"version" : "1.4.4",
"devDependencies": {
"phantomjs": "0.2.2"
},
Expand Down
6 changes: 1 addition & 5 deletions underscore-min.js

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions underscore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Underscore.js 1.4.3
// Underscore.js 1.4.4
// http://underscorejs.org
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore may be freely distributed under the MIT license.

(function() {
Expand Down Expand Up @@ -64,7 +64,7 @@
}

// Current version.
_.VERSION = '1.4.3';
_.VERSION = '1.4.4';

// Collection Functions
// --------------------
Expand Down Expand Up @@ -574,9 +574,6 @@
// Function (ahem) Functions
// ------------------

// Reusable constructor function for prototype setting.
var ctor = function(){};

// Create a function bound to a given object (assigning `this`, and arguments,
// optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
// available.
Expand Down

0 comments on commit 484bdb4

Please sign in to comment.