Skip to content

Commit

Permalink
Underscore.js 1.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Jan 4, 2012
1 parent f79c5ab commit 4946c54
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 58 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2011 Jeremy Ashkenas, DocumentCloud
Copyright (c) 2009-2012 Jeremy Ashkenas, DocumentCloud

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
48 changes: 28 additions & 20 deletions docs/underscore.html

Large diffs are not rendered by default.

42 changes: 32 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,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.2.3)</a></td>
<td><a href="underscore.js">Development Version (1.2.4)</a></td>
<td><i>34kb, Uncompressed with Comments</i></td>
</tr>
<tr>
<td><a href="underscore-min.js">Production Version (1.2.3)</a></td>
<td><a href="underscore-min.js">Production Version (1.2.4)</a></td>
<td><i>&lt; 4kb, Minified and Gzipped</i></td>
</tr>
</table>
Expand Down Expand Up @@ -232,7 +232,7 @@ <h2 id="styles">Object-Oriented and Functional Styles</h2>
{line : 4, words : "He sleeps all night and he works all day"}
];

_(lyrics).chain()
_.chain(lyrics)
.map(function(line) { return line.words.split(' '); })
.flatten()
.reduce(function(counts, word) {
Expand Down Expand Up @@ -958,11 +958,11 @@ <h2>Object Functions</h2>
The primary purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
</p>
<pre>
_([1,2,3,200]).chain().
filter(function(num) { return num % 2 == 0; }).
tap(console.log).
map(function(num) { return num * num }).
value();
_.chain([1,2,3,200])
.filter(function(num) { return num % 2 == 0; })
.tap(console.log)
.map(function(num) { return num * num })
.value();
=&gt; [2, 200]
=&gt; [4, 40000]
</pre>
Expand Down Expand Up @@ -1257,15 +1257,15 @@ <h2>Utility Functions</h2>
<h2>Chaining</h2>

<p id="chain">
<b class="header">chain</b><code>_(obj).chain()</code>
<b class="header">chain</b><code>_.chain(obj)</code>
<br />
Returns a wrapped object. Calling methods on this object will continue
to return wrapped objects until <tt>value</tt> is used. (
<a href="#styles">A more realistic example.</a>)
</p>
<pre>
var stooges = [{name : 'curly', age : 25}, {name : 'moe', age : 21}, {name : 'larry', age : 23}];
var youngest = _(stooges).chain()
var youngest = _.chain(stooges)
.sortBy(function(stooge){ return stooge.age; })
.map(function(stooge){ return stooge.name + ' is ' + stooge.age; })
.first()
Expand Down Expand Up @@ -1341,6 +1341,28 @@ <h2>Links &amp; Suggested Reading</h2>

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

<p>
<b class="header">1.2.4</b> &mdash; <small><i>Jan. 4, 2012</i></small><br />
<ul>
<li>
You now can (and probably should) write <tt>_.chain(list)</tt>
instead of <tt>_(list).chain()</tt>.
</li>
<li>
Fix for escaped characters in Underscore templates, and for supporting
customizations of <tt>_.templateSettings</tt> that only define one or
two of the required regexes.
</li>
<li>
Fix for passing an array as the first argument to an <tt>_.wrap</tt>'d function.
</li>
<li>
Improved compatibility with ClojureScript, which adds a <tt>call</tt>
function to <tt>String.prototype</tt>.
</li>
</ul>
</p>

<p>
<b class="header">1.2.3</b> &mdash; <small><i>Dec. 7, 2011</i></small><br />
<ul>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"dependencies" : [],
"repository" : {"type": "git", "url": "git://github.com/documentcloud/underscore.git"},
"main" : "underscore.js",
"version" : "1.2.3"
"version" : "1.2.4"
}
Loading

0 comments on commit 4946c54

Please sign in to comment.