Skip to content

Commit

Permalink
Underscore 0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Jan 2, 2010
1 parent 4be6a19 commit 385404b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
20 changes: 18 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ <h2>Downloads <i style="padding-left: 12px; font-size:12px;">(Right-click, and u
<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>
Expand Down Expand Up @@ -1067,6 +1067,22 @@ <h2>Links &amp; Suggested Reading</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
Expand Down
21 changes: 11 additions & 10 deletions underscore-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'.
Expand Down Expand Up @@ -396,7 +396,7 @@
};
};

/* ------------------------- Object Functions: ---------------------------- */
// ------------------------- Object Functions: ------------------------------

// Retrieve the names of an object's properties.
_.keys = function(obj) {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -577,7 +577,7 @@
return data ? fn(data) : fn;
};

/*------------------------------- Aliases ----------------------------------*/
// ------------------------------- Aliases ----------------------------------

_.forEach = _.each;
_.foldl = _.inject = _.reduce;
Expand All @@ -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) {
Expand Down

0 comments on commit 385404b

Please sign in to comment.