Underscore 0.5.2

This commit is contained in:
Jeremy Ashkenas
2010-01-01 21:32:44 -05:00
parent 4be6a194cd
commit 385404b685
3 changed files with 38 additions and 21 deletions

View File

@@ -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) {