Permalink
Browse files

Underscore 0.5.2

  • Loading branch information...
1 parent 4be6a19 commit 385404b685145f2b02be8e81f8e46b654275edca @jashkenas committed Jan 2, 2010
Showing with 38 additions and 21 deletions.
  1. +18 −2 index.html
  2. +11 −10 underscore-min.js
  3. +9 −9 underscore.js
View
@@ -113,11 +113,11 @@
<p>
<table>
<tr>
- <td><a href="underscore.js">Development Version (0.5.1)</a></td>
+ <td><a href="underscore.js">Development Version (0.5.2)</a></td>
<td><i>21kb, Uncompressed with Comments</i></td>
</tr>
<tr>
- <td><a href="underscore-min.js">Production Version (0.5.1)</a></td>
+ <td><a href="underscore-min.js">Production Version (0.5.2)</a></td>
<td><i>3kb, Packed and Gzipped</i></td>
</tr>
</table>
@@ -1068,6 +1068,22 @@ <h2 id="styles">Object-Oriented and Functional Styles</h2>
<h2>Change Log</h2>
<p>
+ <b class="header">0.5.2</b><br />
+ New implementations of <tt>isArray</tt>, <tt>isDate</tt>, <tt>isFunction</tt>,
+ <tt>isNumber</tt>, <tt>isRegExp</tt>, and <tt>isString</tt>, thanks to
+ a suggestion from
+ <a href="http://www.broofa.com/">Robert Kieffer</a>.
+ Instead of doing <tt>Object#toString</tt>
+ comparisons, they now check for expected properties, which is less safe,
+ but more than an order of magnitude faster. Most other Underscore
+ functions saw minor speed improvements as a result.
+ <a href="http://dolzhenko.org/">Evgeniy Dolzhenko</a>
+ contributed <tt>_.tap</tt>,
+ <a href="http://ruby-doc.org/core-1.9/classes/Object.html#M000191">similar to Ruby 1.9's</a>,
+ which is handy for injecting side effects (like logging) into chained calls.
+ </p>
+
+ <p>
<b class="header">0.5.1</b><br />
Added an <tt>_.isArguments</tt> function. Lots of little safety checks
and optimizations contributed by
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -8,7 +8,7 @@
(function() {
- /*------------------------- Baseline setup ---------------------------------*/
+ // ------------------------- Baseline setup ---------------------------------
// Establish the root object, "window" in the browser, or "global" on the server.
var root = this;
@@ -38,9 +38,9 @@
propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
// Current version.
- _.VERSION = '0.5.1';
+ _.VERSION = '0.5.2';
- /*------------------------ Collection Functions: ---------------------------*/
+ // ------------------------ Collection Functions: ---------------------------
// The cornerstone, an each implementation.
// Handles objects implementing forEach, arrays, and raw objects.
@@ -234,7 +234,7 @@
return _.toArray(obj).length;
};
- /*-------------------------- Array Functions: ------------------------------*/
+ // -------------------------- Array Functions: ------------------------------
// Get the first element of an array. Passing "n" will return the first N
// values in the array. Aliased as "head". The "guard" check allows it to work
@@ -340,7 +340,7 @@
}
};
- /* ----------------------- Function Functions: -----------------------------*/
+ // ----------------------- Function Functions: ------------------------------
// Create a function bound to a given object (assigning 'this', and arguments,
// optionally). Binding with arguments is also known as 'curry'.
@@ -396,7 +396,7 @@
};
};
- /* ------------------------- Object Functions: ---------------------------- */
+ // ------------------------- Object Functions: ------------------------------
// Retrieve the names of an object's properties.
_.keys = function(obj) {
@@ -532,7 +532,7 @@
return typeof obj == 'undefined';
};
- /* -------------------------- Utility Functions: -------------------------- */
+ // -------------------------- Utility Functions: ----------------------------
// Run Underscore.js in noConflict mode, returning the '_' variable to its
// previous owner. Returns a reference to the Underscore object.
@@ -577,7 +577,7 @@
return data ? fn(data) : fn;
};
- /*------------------------------- Aliases ----------------------------------*/
+ // ------------------------------- Aliases ----------------------------------
_.forEach = _.each;
_.foldl = _.inject = _.reduce;
@@ -589,7 +589,7 @@
_.tail = _.rest;
_.methods = _.functions;
- /*------------------------ Setup the OOP Wrapper: --------------------------*/
+ // ------------------------ Setup the OOP Wrapper: --------------------------
// Helper function to continue chaining intermediate results.
var result = function(obj, chain) {

0 comments on commit 385404b

Please sign in to comment.