diff --git a/docs/docco.css b/docs/docco.css index 714cfb997..f690a0794 100644 --- a/docs/docco.css +++ b/docs/docco.css @@ -51,17 +51,9 @@ b, strong { font-family: "aller-bold"; } -p { +p, ul, ol { margin: 15px 0 0px; } - .annotation ul, .annotation ol { - margin: 25px 0; - } - .annotation ul li, .annotation ol li { - font-size: 14px; - line-height: 18px; - margin: 10px 0; - } h1, h2, h3, h4, h5, h6 { color: #112233; @@ -399,8 +391,7 @@ pre .css .rule .keyword, pre .winutils, pre .javascript .title, pre .lisp .title, -pre .subst, -pre .reserved { +pre .subst { color: #954121; /*font-weight: bold*/ } diff --git a/docs/underscore.html b/docs/underscore.html index 00c07a54a..b96d40874 100644 --- a/docs/underscore.html +++ b/docs/underscore.html @@ -27,15 +27,14 @@

underscore.js

-
Underscore.js 1.5.1
+              
Underscore.js 1.5.2
 http://underscorejs.org
 (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 Underscore may be freely distributed under the MIT license.
-
-(function() {
+
(function() {
@@ -59,9 +58,12 @@

Baseline setup

- +

Establish the root object, window in the browser, or exports on the server.

+ +
  var root = this;
+ @@ -71,12 +73,11 @@

Baseline setup

-

Establish the root object, window in the browser, or global on the server. -

+

Save the previous value of the _ variable.

-
  var root = this;
+
  var previousUnderscore = root._;
@@ -87,12 +88,11 @@

Baseline setup

-

Save the previous value of the _ variable. -

+

Establish the object that gets returned to break out of a loop iteration.

-
  var previousUnderscore = root._;
+
  var breaker = {};
@@ -103,12 +103,11 @@

Baseline setup

-

Establish the object that gets returned to break out of a loop iteration. -

+

Save bytes in the minified (but not gzipped) version:

-
  var breaker = {};
+
  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
@@ -119,24 +118,7 @@

Baseline setup

-

Save bytes in the minified (but not gzipped) version: -

- - - -
  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
- - - - -
  • -
    - -
    - -
    -

    Create quick reference variables for speed access to core prototypes. -

    +

    Create quick reference variables for speed access to core prototypes.

    @@ -150,15 +132,14 @@

    Baseline setup

  • -
  • +
  • - +

    All ECMAScript 5 native function implementations that we hope to use -are declared here. -

    +are declared here.

    @@ -179,14 +160,13 @@

    Baseline setup

  • -
  • +
  • - +
    -

    Create a safe reference to the Underscore object for use below. -

    +

    Create a safe reference to the Underscore object for use below.

    @@ -199,17 +179,16 @@

    Baseline setup

  • -
  • +
  • - +

    Export the Underscore object for Node.js, with backwards-compatibility for the old require() API. If we're in the browser, add _ as a global object via a string identifier, -for Closure Compiler "advanced" mode. -

    +for Closure Compiler "advanced" mode.

    @@ -225,27 +204,26 @@

    Baseline setup

  • -
  • +
  • - +
    -

    Current version. -

    +

    Current version.

    -
      _.VERSION = '1.5.1';
    +
      _.VERSION = '1.5.2';
  • -
  • +
  • - +

    Collection Functions

    @@ -254,28 +232,15 @@

    Collection Functions

  • -
  • -
    - -
    - -
    - -
    - -
  • - - -
  • +
  • - +

    The cornerstone, an each implementation, aka forEach. Handles objects with the built-in forEach, arrays, and raw objects. -Delegates to ECMAScript 5's native forEach if available. -

    +Delegates to ECMAScript 5's native forEach if available.

    @@ -284,14 +249,13 @@

    Collection Functions

    if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { - for (var i = 0, l = obj.length; i < l; i++) { + for (var i = 0, length = obj.length; i < length; i++) { if (iterator.call(context, obj[i], i, obj) === breaker) return; } } else { - for (var key in obj) { - if (_.has(obj, key)) { - if (iterator.call(context, obj[key], key, obj) === breaker) return; - } + var keys = _.keys(obj); + for (var i = 0, length = keys.length; i < length; i++) { + if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return; } } };
  • @@ -299,15 +263,14 @@

    Collection Functions

    -
  • +
  • - +

    Return the results of applying the iterator to each element. -Delegates to ECMAScript 5's native map if available. -

    +Delegates to ECMAScript 5's native map if available.

    @@ -326,15 +289,14 @@

    Collection Functions

  • -
  • +
  • - +

    Reduce builds up a single result from a list of values, aka inject, -or foldl. Delegates to ECMAScript 5's native reduce if available. -

    +or foldl. Delegates to ECMAScript 5's native reduce if available.

    @@ -360,15 +322,14 @@

    Collection Functions

  • -
  • +
  • - +

    The right-associative version of reduce, also known as foldr. -Delegates to ECMAScript 5's native reduceRight if available. -

    +Delegates to ECMAScript 5's native reduceRight if available.

    @@ -400,14 +361,13 @@

    Collection Functions

  • -
  • +
  • - +
    -

    Return the first value which passes a truth test. Aliased as detect. -

    +

    Return the first value which passes a truth test. Aliased as detect.

    @@ -425,16 +385,15 @@

    Collection Functions

  • -
  • +
  • - +

    Return all the elements that pass a truth test. Delegates to ECMAScript 5's native filter if available. -Aliased as select. -

    +Aliased as select.

    @@ -451,14 +410,13 @@

    Collection Functions

  • -
  • +
  • - +
    -

    Return all the elements for which a truth test fails. -

    +

    Return all the elements for which a truth test fails.

    @@ -471,16 +429,15 @@

    Collection Functions

  • -
  • +
  • - +

    Determine whether all of the elements match a truth test. Delegates to ECMAScript 5's native every if available. -Aliased as all. -

    +Aliased as all.

    @@ -498,16 +455,15 @@

    Collection Functions

  • -
  • +
  • - +

    Determine if at least one element in the object matches a truth test. Delegates to ECMAScript 5's native some if available. -Aliased as any. -

    +Aliased as any.

    @@ -525,15 +481,14 @@

    Collection Functions

  • -
  • +
  • - +

    Determine if the array or object contains a given value (using ===). -Aliased as include. -

    +Aliased as include.

    @@ -548,14 +503,13 @@

    Collection Functions

  • -
  • +
  • - +
    -

    Invoke a method (with arguments) on every item in a collection. -

    +

    Invoke a method (with arguments) on every item in a collection.

    @@ -570,14 +524,13 @@

    Collection Functions

  • -
  • +
  • - +
    -

    Convenience version of a common use case of map: fetching a property. -

    +

    Convenience version of a common use case of map: fetching a property.

    @@ -588,15 +541,14 @@

    Collection Functions

  • -
  • +
  • - +

    Convenience version of a common use case of filter: selecting only objects -containing specific key:value pairs. -

    +containing specific key:value pairs.

    @@ -613,15 +565,14 @@

    Collection Functions

  • -
  • +
  • - +

    Convenience version of a common use case of find: getting the first object -containing specific key:value pairs. -

    +containing specific key:value pairs.

    @@ -632,16 +583,15 @@

    Collection Functions

  • -
  • +
  • - +

    Return the maximum element or (element-based computation). Can't optimize arrays of integers longer than 65,535 elements. -See WebKit Bug 80797 -

    +See WebKit Bug 80797

    @@ -661,14 +611,13 @@

    Collection Functions

  • -
  • +
  • - +
    -

    Return the minimum element (or element-based computation). -

    +

    Return the minimum element (or element-based computation).

    @@ -688,14 +637,14 @@

    Collection Functions

  • -
  • +
  • - +
    -

    Shuffle an array. -

    +

    Shuffle an array, using the modern version of the +Fisher-Yates shuffle.

    @@ -714,14 +663,35 @@

    Collection Functions

  • -
  • +
  • - + +
    +

    Sample n random values from an array. +If n is not specified, returns a single random element from the array. +The internal guard argument allows it to work with map.

    + +
    + +
      _.sample = function(obj, n, guard) {
    +    if (arguments.length < 2 || guard) {
    +      return obj[_.random(obj.length - 1)];
    +    }
    +    return _.shuffle(obj).slice(0, Math.max(0, n));
    +  };
    + +
  • + + +
  • +
    + +
    +
    -

    An internal function to generate lookup iterators. -

    +

    An internal function to generate lookup iterators.

    @@ -732,14 +702,13 @@

    Collection Functions

  • -
  • +
  • - +
    -

    Sort the object's values by a criterion produced by an iterator. -

    +

    Sort the object's values by a criterion produced by an iterator.

    @@ -747,9 +716,9 @@

    Collection Functions

    var iterator = lookupIterator(value); return _.pluck(_.map(obj, function(value, index, list) { return { - value : value, - index : index, - criteria : iterator.call(context, value, index, list) + value: value, + index: index, + criteria: iterator.call(context, value, index, list) }; }).sort(function(left, right) { var a = left.criteria; @@ -758,33 +727,52 @@

    Collection Functions

    if (a > b || a === void 0) return 1; if (a < b || b === void 0) return -1; } - return left.index < right.index ? -1 : 1; + return left.index - right.index; }), 'value'); };
  • +
  • +
    + +
    + +
    +

    An internal function used for aggregate "group by" operations.

    + +
    + +
      var group = function(behavior) {
    +    return function(obj, value, context) {
    +      var result = {};
    +      var iterator = value == null ? _.identity : lookupIterator(value);
    +      each(obj, function(value, index) {
    +        var key = iterator.call(context, value, index, obj);
    +        behavior(result, key, value);
    +      });
    +      return result;
    +    };
    +  };
    + +
  • + +
  • -

    An internal function used for aggregate "group by" operations. -

    +

    Groups the object's values by a criterion. Pass either a string attribute +to group by, or a function that returns the criterion.

    -
      var group = function(obj, value, context, behavior) {
    -    var result = {};
    -    var iterator = lookupIterator(value == null ? _.identity : value);
    -    each(obj, function(value, index) {
    -      var key = iterator.call(context, value, index, obj);
    -      behavior(result, key, value);
    -    });
    -    return result;
    -  };
    +
      _.groupBy = group(function(result, key, value) {
    +    (_.has(result, key) ? result[key] : (result[key] = [])).push(value);
    +  });
  • @@ -795,17 +783,14 @@

    Collection Functions

    -

    Groups the object's values by a criterion. Pass either a string attribute -to group by, or a function that returns the criterion. -

    +

    Indexes the object's values by a criterion, similar to groupBy, but for +when you know that your index values will be unique.

    -
      _.groupBy = function(obj, value, context) {
    -    return group(obj, value, context, function(result, key, value) {
    -      (_.has(result, key) ? result[key] : (result[key] = [])).push(value);
    -    });
    -  };
    +
      _.indexBy = group(function(result, key, value) {
    +    result[key] = value;
    +  });
    @@ -818,17 +803,13 @@

    Collection Functions

    Counts instances of an object that group by a certain criterion. Pass either a string attribute to count by, or a function that returns the -criterion. -

    +criterion.

    -
      _.countBy = function(obj, value, context) {
    -    return group(obj, value, context, function(result, key) {
    -      if (!_.has(result, key)) result[key] = 0;
    -      result[key]++;
    -    });
    -  };
    +
      _.countBy = group(function(result, key) {
    +    _.has(result, key) ? result[key]++ : result[key] = 1;
    +  });
    @@ -840,8 +821,7 @@

    Collection Functions

    Use a comparator function to figure out the smallest index at which -an object should be inserted so as to maintain order. Uses binary search. -

    +an object should be inserted so as to maintain order. Uses binary search.

    @@ -865,8 +845,7 @@

    Collection Functions

    -

    Safely create a real, live array from anything iterable. -

    +

    Safely create a real, live array from anything iterable.

    @@ -886,8 +865,7 @@

    Collection Functions

    -

    Return the number of elements in an object. -

    +

    Return the number of elements in an object.

    @@ -918,44 +896,30 @@

    Array Functions

    - - - - - - -
  • -
    - -
    - -

    Get the first element of an array. Passing n will return the first N values in the array. Aliased as head and take. The guard check -allows it to work with _.map. -

    +allows it to work with _.map.

      _.first = _.head = _.take = function(array, n, guard) {
         if (array == null) return void 0;
    -    return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
    +    return (n == null) || guard ? array[0] : slice.call(array, 0, n);
       };
  • -
  • +
  • - +

    Returns everything but the last entry of the array. Especially useful on the arguments object. Passing n will return all the values in the array, excluding the last N. The guard check allows it to work with -_.map. -

    +_.map.

    @@ -966,41 +930,39 @@

    Array Functions

  • -
  • +
  • - +

    Get the last element of an array. Passing n will return the last N -values in the array. The guard check allows it to work with _.map. -

    +values in the array. The guard check allows it to work with _.map.

      _.last = function(array, n, guard) {
         if (array == null) return void 0;
    -    if ((n != null) && !guard) {
    -      return slice.call(array, Math.max(array.length - n, 0));
    -    } else {
    +    if ((n == null) || guard) {
           return array[array.length - 1];
    +    } else {
    +      return slice.call(array, Math.max(array.length - n, 0));
         }
       };
  • -
  • +
  • - +

    Returns everything but the first entry of the array. Aliased as tail and drop. Especially useful on the arguments object. Passing an n will return the rest N values in the array. The guard -check allows it to work with _.map. -

    +check allows it to work with _.map.

    @@ -1011,14 +973,13 @@

    Array Functions

  • -
  • +
  • - +
    -

    Trim out all falsy values from an array. -

    +

    Trim out all falsy values from an array.

    @@ -1029,14 +990,13 @@

    Array Functions

  • -
  • +
  • - +
    -

    Internal implementation of a recursive flatten function. -

    +

    Internal implementation of a recursive flatten function.

    @@ -1057,14 +1017,13 @@

    Array Functions

  • -
  • +
  • - +
    -

    Return a completely flattened version of an array. -

    +

    Flatten out an array, either recursively (by default), or just one level.

    @@ -1075,14 +1034,13 @@

    Array Functions

  • -
  • +
  • - +
    -

    Return a version of the array that does not contain the specified value(s). -

    +

    Return a version of the array that does not contain the specified value(s).

    @@ -1093,16 +1051,15 @@

    Array Functions

  • -
  • +
  • - +

    Produce a duplicate-free version of the array. If the array has already been sorted, you have the option of using a faster algorithm. -Aliased as unique. -

    +Aliased as unique.

    @@ -1127,15 +1084,14 @@

    Array Functions

  • -
  • +
  • - +

    Produce an array that contains the union: each distinct element from all of -the passed-in arrays. -

    +the passed-in arrays.

    @@ -1146,15 +1102,14 @@

    Array Functions

  • -
  • +
  • - +

    Produce an array that contains every item shared between all the -passed-in arrays. -

    +passed-in arrays.

    @@ -1170,15 +1125,14 @@

    Array Functions

  • -
  • +
  • - +

    Take the difference between one array and a number of other arrays. -Only the elements present in just the first array will remain. -

    +Only the elements present in just the first array will remain.

    @@ -1190,15 +1144,14 @@

    Array Functions

  • -
  • +
  • - +

    Zip together multiple lists into a single array -- elements that share -an index go together. -

    +an index go together.

    @@ -1214,23 +1167,22 @@

    Array Functions

  • -
  • +
  • - +

    Converts lists into objects. Pass either a single array of [key, value] pairs, or two parallel arrays of the same length -- one of keys, and one of -the corresponding values. -

    +the corresponding values.

      _.object = function(list, values) {
         if (list == null) return {};
         var result = {};
    -    for (var i = 0, l = list.length; i < l; i++) {
    +    for (var i = 0, length = list.length; i < length; i++) {
           if (values) {
             result[list[i]] = values[i];
           } else {
    @@ -1243,49 +1195,47 @@ 

    Array Functions

  • -
  • +
  • - +

    If the browser doesn't supply us with indexOf (I'm looking at you, MSIE), we need this function. Return the position of the first occurrence of an item in an array, or -1 if the item is not included in the array. Delegates to ECMAScript 5's native indexOf if available. If the array is large and already in sort order, pass true -for isSorted to use binary search. -

    +for isSorted to use binary search.

      _.indexOf = function(array, item, isSorted) {
         if (array == null) return -1;
    -    var i = 0, l = array.length;
    +    var i = 0, length = array.length;
         if (isSorted) {
           if (typeof isSorted == 'number') {
    -        i = (isSorted < 0 ? Math.max(0, l + isSorted) : isSorted);
    +        i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted);
           } else {
             i = _.sortedIndex(array, item);
             return array[i] === item ? i : -1;
           }
         }
         if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
    -    for (; i < l; i++) if (array[i] === item) return i;
    +    for (; i < length; i++) if (array[i] === item) return i;
         return -1;
       };
  • -
  • +
  • - +
    -

    Delegates to ECMAScript 5's native lastIndexOf if available. -

    +

    Delegates to ECMAScript 5's native lastIndexOf if available.

    @@ -1303,16 +1253,15 @@

    Array Functions

  • -
  • +
  • - +

    Generate an integer Array containing an arithmetic progression. A port of the native Python range() function. See -the Python documentation. -

    +the Python documentation.

    @@ -1323,11 +1272,11 @@

    Array Functions

    } step = arguments[2] || 1; - var len = Math.max(Math.ceil((stop - start) / step), 0); + var length = Math.max(Math.ceil((stop - start) / step), 0); var idx = 0; - var range = new Array(len); + var range = new Array(length); - while(idx < len) { + while(idx < length) { range[idx++] = start; start += step; } @@ -1338,11 +1287,11 @@

    Array Functions

  • -
  • +
  • - +

    Function (ahem) Functions

    @@ -1351,26 +1300,13 @@

    Function (ahem) Functions

  • -
  • -
    - -
    - -
    - -
    - -
  • - - -
  • +
  • - +
    -

    Reusable constructor function for prototype setting. -

    +

    Reusable constructor function for prototype setting.

    @@ -1379,16 +1315,15 @@

    Function (ahem) Functions

  • -
  • +
  • - +

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

    +available.

    @@ -1411,15 +1346,14 @@

    Function (ahem) Functions

  • -
  • +
  • - +

    Partially apply a function by creating a version that has had some of its -arguments pre-filled, without changing its dynamic this context. -

    +arguments pre-filled, without changing its dynamic this context.

    @@ -1433,15 +1367,14 @@

    Function (ahem) Functions

  • -
  • +
  • - +

    Bind all of an object's methods to that object. Useful for ensuring that -all callbacks defined on an object belong to it. -

    +all callbacks defined on an object belong to it.

    @@ -1455,14 +1388,13 @@

    Function (ahem) Functions

  • -
  • +
  • - +
    -

    Memoize an expensive function by storing its results. -

    +

    Memoize an expensive function by storing its results.

    @@ -1478,15 +1410,14 @@

    Function (ahem) Functions

  • -
  • +
  • - +

    Delays a function for the given number of milliseconds, and then calls -it with the arguments supplied. -

    +it with the arguments supplied.

    @@ -1498,15 +1429,14 @@

    Function (ahem) Functions

  • -
  • +
  • - +

    Defers a function, scheduling it to run after the current call stack has -cleared. -

    +cleared.

    @@ -1517,18 +1447,17 @@

    Function (ahem) Functions

  • -
  • +
  • - +

    Returns a function, that, when invoked, will only be triggered at most once during a given window of time. Normally, the throttled function will run as much as it can, without ever going more than once per wait duration; but if you'd like to disable the execution on the leading edge, pass -{leading: false}. To disable execution on the trailing edge, ditto. -

    +{leading: false}. To disable execution on the trailing edge, ditto.

    @@ -1563,32 +1492,38 @@

    Function (ahem) Functions

  • -
  • +
  • - +

    Returns a function, that, as long as it continues to be invoked, will not be triggered. The function will be called after it stops being called for N milliseconds. If immediate is passed, trigger the function on the -leading edge, instead of the trailing. -

    +leading edge, instead of the trailing.

      _.debounce = function(func, wait, immediate) {
    -    var result;
    -    var timeout = null;
    +    var timeout, args, context, timestamp, result;
         return function() {
    -      var context = this, args = arguments;
    +      context = this;
    +      args = arguments;
    +      timestamp = new Date();
           var later = function() {
    -        timeout = null;
    -        if (!immediate) result = func.apply(context, args);
    +        var last = (new Date()) - timestamp;
    +        if (last < wait) {
    +          timeout = setTimeout(later, wait - last);
    +        } else {
    +          timeout = null;
    +          if (!immediate) result = func.apply(context, args);
    +        }
           };
           var callNow = immediate && !timeout;
    -      clearTimeout(timeout);
    -      timeout = setTimeout(later, wait);
    +      if (!timeout) {
    +        timeout = setTimeout(later, wait);
    +      }
           if (callNow) result = func.apply(context, args);
           return result;
         };
    @@ -1597,15 +1532,14 @@ 

    Function (ahem) Functions

  • -
  • +
  • - +

    Returns a function that will be executed at most one time, no matter how -often you call it. Useful for lazy initialization. -

    +often you call it. Useful for lazy initialization.

    @@ -1623,16 +1557,15 @@

    Function (ahem) Functions

  • -
  • +
  • - +

    Returns the first function passed as an argument to the second, allowing you to adjust arguments, run code before and after, and -conditionally execute the original function. -

    +conditionally execute the original function.

    @@ -1647,15 +1580,14 @@

    Function (ahem) Functions

  • -
  • +
  • - +

    Returns a function that is the composition of a list of functions, each -consuming the return value of the function that follows. -

    +consuming the return value of the function that follows.

    @@ -1673,14 +1605,13 @@

    Function (ahem) Functions

  • -
  • +
  • - +
    -

    Returns a function that will only be executed after being called N times. -

    +

    Returns a function that will only be executed after being called N times.

    @@ -1695,11 +1626,11 @@

    Function (ahem) Functions

  • -
  • +
  • - +

    Object Functions

    @@ -1708,27 +1639,14 @@

    Object Functions

  • -
  • -
    - -
    - -
    - -
    - -
  • - - -
  • +
  • - +

    Retrieve the names of an object's properties. -Delegates to ECMAScript 5's native Object.keys -

    +Delegates to ECMAScript 5's native Object.keys

    @@ -1742,75 +1660,82 @@

    Object Functions

  • -
  • +
  • - +
    -

    Retrieve the values of an object's properties. -

    +

    Retrieve the values of an object's properties.

      _.values = function(obj) {
    -    var values = [];
    -    for (var key in obj) if (_.has(obj, key)) values.push(obj[key]);
    +    var keys = _.keys(obj);
    +    var length = keys.length;
    +    var values = new Array(length);
    +    for (var i = 0; i < length; i++) {
    +      values[i] = obj[keys[i]];
    +    }
         return values;
       };
  • -
  • +
  • - +
    -

    Convert an object into a list of [key, value] pairs. -

    +

    Convert an object into a list of [key, value] pairs.

      _.pairs = function(obj) {
    -    var pairs = [];
    -    for (var key in obj) if (_.has(obj, key)) pairs.push([key, obj[key]]);
    +    var keys = _.keys(obj);
    +    var length = keys.length;
    +    var pairs = new Array(length);
    +    for (var i = 0; i < length; i++) {
    +      pairs[i] = [keys[i], obj[keys[i]]];
    +    }
         return pairs;
       };
  • -
  • +
  • - +
    -

    Invert the keys and values of an object. The values must be serializable. -

    +

    Invert the keys and values of an object. The values must be serializable.

      _.invert = function(obj) {
         var result = {};
    -    for (var key in obj) if (_.has(obj, key)) result[obj[key]] = key;
    +    var keys = _.keys(obj);
    +    for (var i = 0, length = keys.length; i < length; i++) {
    +      result[obj[keys[i]]] = keys[i];
    +    }
         return result;
       };
  • -
  • +
  • - +

    Return a sorted list of the function names available on the object. -Aliased as methods -

    +Aliased as methods

    @@ -1825,14 +1750,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Extend a given object with all the properties in passed-in object(s). -

    +

    Extend a given object with all the properties in passed-in object(s).

    @@ -1850,14 +1774,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Return a copy of the object only containing the whitelisted properties. -

    +

    Return a copy of the object only containing the whitelisted properties.

    @@ -1873,14 +1796,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Return a copy of the object without the blacklisted properties. -

    +

    Return a copy of the object without the blacklisted properties.

    @@ -1896,14 +1818,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Fill in a given object with default properties. -

    +

    Fill in a given object with default properties.

    @@ -1921,14 +1842,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Create a (shallow-cloned) duplicate of an object. -

    +

    Create a (shallow-cloned) duplicate of an object.

    @@ -1940,16 +1860,15 @@

    Object Functions

  • -
  • +
  • - +

    Invokes interceptor with the obj, and then returns obj. The primary purpose of this method is to "tap into" a method chain, in -order to perform operations on intermediate results within the chain. -

    +order to perform operations on intermediate results within the chain.

    @@ -1961,14 +1880,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Internal recursive comparison function for isEqual. -

    +

    Internal recursive comparison function for isEqual.

    @@ -1977,15 +1895,14 @@

    Object Functions

  • -
  • +
  • - +

    Identical objects are equal. 0 === -0, but they aren't identical. -See the Harmony egal proposal. -

    +See the Harmony egal proposal.

    @@ -1994,14 +1911,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    A strict comparison is necessary because null == undefined. -

    +

    A strict comparison is necessary because null == undefined.

    @@ -2010,14 +1926,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Unwrap any wrapped objects. -

    +

    Unwrap any wrapped objects.

    @@ -2027,14 +1942,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Compare [[Class]] names. -

    +

    Compare [[Class]] names.

    @@ -2045,14 +1959,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Strings, numbers, dates, and booleans are compared by value. -

    +

    Strings, numbers, dates, and booleans are compared by value.

    @@ -2061,15 +1974,14 @@

    Object Functions

  • -
  • +
  • - +

    Primitives and their corresponding object wrappers are equivalent; thus, "5" is -equivalent to new String("5"). -

    +equivalent to new String("5").

    @@ -2079,15 +1991,14 @@

    Object Functions

  • -
  • +
  • - +

    NaNs are equivalent, but non-reflexive. An egal comparison is performed for -other numeric values. -

    +other numeric values.

    @@ -2098,16 +2009,15 @@

    Object Functions

  • -
  • +
  • - +

    Coerce dates and booleans to numeric primitive values. Dates are compared by their millisecond representations. Note that invalid dates with millisecond representations -of NaN are not equivalent. -

    +of NaN are not equivalent.

    @@ -2116,14 +2026,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    RegExps are compared by their source patterns and flags. -

    +

    RegExps are compared by their source patterns and flags.

    @@ -2138,15 +2047,14 @@

    Object Functions

  • -
  • +
  • - +

    Assume equality for cyclic structures. The algorithm for detecting cyclic -structures is adapted from ES 5.1 section 15.12.3, abstract operation JO. -

    +structures is adapted from ES 5.1 section 15.12.3, abstract operation JO.

    @@ -2156,15 +2064,14 @@

    Object Functions

  • -
  • +
  • - +

    Linear search. Performance is inversely proportional to the number of -unique nested structures. -

    +unique nested structures.

    @@ -2174,15 +2081,14 @@

    Object Functions

  • -
  • +
  • - +

    Objects with different constructors are not equivalent, but Objects -from different frames are. -

    +from different frames are.

    @@ -2195,14 +2101,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Add the first object to the stack of traversed objects. -

    +

    Add the first object to the stack of traversed objects.

    @@ -2213,14 +2118,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Recursively compare objects and arrays. -

    +

    Recursively compare objects and arrays.

    @@ -2229,14 +2133,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Compare array lengths to determine if a deep comparison is necessary. -

    +

    Compare array lengths to determine if a deep comparison is necessary.

    @@ -2247,14 +2150,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Deep compare the contents, ignoring non-numeric properties. -

    +

    Deep compare the contents, ignoring non-numeric properties.

    @@ -2267,14 +2169,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Deep compare objects. -

    +

    Deep compare objects.

    @@ -2284,14 +2185,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Count the expected number of properties. -

    +

    Count the expected number of properties.

    @@ -2300,14 +2200,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Deep compare each member. -

    +

    Deep compare each member.

    @@ -2318,14 +2217,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Ensure that both objects contain the same number of properties. -

    +

    Ensure that both objects contain the same number of properties.

    @@ -2340,14 +2238,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Remove the first object from the stack of traversed objects. -

    +

    Remove the first object from the stack of traversed objects.

    @@ -2359,14 +2256,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Perform a deep comparison to check if two objects are equal. -

    +

    Perform a deep comparison to check if two objects are equal.

    @@ -2377,15 +2273,14 @@

    Object Functions

  • -
  • +
  • - +

    Is a given array, string, or object empty? -An "empty" object has no enumerable own-properties. -

    +An "empty" object has no enumerable own-properties.

    @@ -2399,14 +2294,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Is a given value a DOM element? -

    +

    Is a given value a DOM element?

    @@ -2417,15 +2311,14 @@

    Object Functions

  • -
  • +
  • - +

    Is a given value an array? -Delegates to ECMA5's native Array.isArray -

    +Delegates to ECMA5's native Array.isArray

    @@ -2436,14 +2329,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Is a given variable an object? -

    +

    Is a given variable an object?

    @@ -2454,14 +2346,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp. -

    +

    Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.

    @@ -2474,15 +2365,14 @@

    Object Functions

  • -
  • +
  • - +

    Define a fallback version of the method in browsers (ahem, IE), where -there isn't any inspectable "Arguments" type. -

    +there isn't any inspectable "Arguments" type.

    @@ -2495,14 +2385,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Optimize isFunction if appropriate. -

    +

    Optimize isFunction if appropriate.

    @@ -2515,14 +2404,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Is a given object a finite number? -

    +

    Is a given object a finite number?

    @@ -2533,14 +2421,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Is the given value NaN? (NaN is the only number which does not equal itself). -

    +

    Is the given value NaN? (NaN is the only number which does not equal itself).

    @@ -2551,14 +2438,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Is a given value a boolean? -

    +

    Is a given value a boolean?

    @@ -2569,14 +2455,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Is a given value equal to null? -

    +

    Is a given value equal to null?

    @@ -2587,14 +2472,13 @@

    Object Functions

  • -
  • +
  • - +
    -

    Is a given variable undefined? -

    +

    Is a given variable undefined?

    @@ -2605,15 +2489,14 @@

    Object Functions

  • -
  • +
  • - +

    Shortcut function for checking if an object has a given property directly -on itself (in other words, not on a prototype). -

    +on itself (in other words, not on a prototype).

    @@ -2624,11 +2507,11 @@

    Object Functions

  • -
  • +
  • - +

    Utility Functions

    @@ -2637,27 +2520,14 @@

    Utility Functions

  • -
  • -
    - -
    - -
    - -
    - -
  • - - -
  • +
  • - +

    Run Underscore.js in noConflict mode, returning the _ variable to its -previous owner. Returns a reference to the Underscore object. -

    +previous owner. Returns a reference to the Underscore object.

    @@ -2669,14 +2539,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    Keep the identity function around for default iterators. -

    +

    Keep the identity function around for default iterators.

    @@ -2687,14 +2556,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    Run a function n times. -

    +

    Run a function n times.

    @@ -2707,14 +2575,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    Return a random integer between min and max (inclusive). -

    +

    Return a random integer between min and max (inclusive).

    @@ -2729,14 +2596,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    List of HTML entities for escaping. -

    +

    List of HTML entities for escaping.

    @@ -2746,8 +2612,7 @@

    Utility Functions

    '<': '&lt;', '>': '&gt;', '"': '&quot;', - "'": '&#x27;', - '/': '&#x2F;' + "'": '&#x27;' } }; entityMap.unescape = _.invert(entityMap.escape); @@ -2755,14 +2620,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    Regexes containing the keys and values listed immediately above. -

    +

    Regexes containing the keys and values listed immediately above.

    @@ -2774,14 +2638,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    Functions for escaping and unescaping strings to/from HTML interpolation. -

    +

    Functions for escaping and unescaping strings to/from HTML interpolation.

    @@ -2797,15 +2660,14 @@

    Utility Functions

  • -
  • +
  • - +

    If the value of the named property is a function then invoke it with the -object as context; otherwise, return it. -

    +object as context; otherwise, return it.

    @@ -2818,19 +2680,18 @@

    Utility Functions

  • -
  • +
  • - +
    -

    Add your own custom functions to the Underscore object. -

    +

    Add your own custom functions to the Underscore object.

      _.mixin = function(obj) {
    -    each(_.functions(obj), function(name){
    +    each(_.functions(obj), function(name) {
           var func = _[name] = obj[name];
           _.prototype[name] = function() {
             var args = [this._wrapped];
    @@ -2843,15 +2704,14 @@ 

    Utility Functions

  • -
  • +
  • - +

    Generate a unique integer id (unique within the entire client session). -Useful for temporary DOM ids. -

    +Useful for temporary DOM ids.

    @@ -2864,15 +2724,14 @@

    Utility Functions

  • -
  • +
  • - +

    By default, Underscore uses ERB-style template delimiters, change the -following template settings to use alternative delimiters. -

    +following template settings to use alternative delimiters.

    @@ -2885,16 +2744,15 @@

    Utility Functions

  • -
  • +
  • - +

    When customizing templateSettings, if you don't want to define an interpolation, evaluation or escaping regex, we need one that is -guaranteed not to match. -

    +guaranteed not to match.

    @@ -2903,15 +2761,14 @@

    Utility Functions

  • -
  • +
  • - +

    Certain characters need to be escaped so that they can be put into a -string literal. -

    +string literal.

    @@ -2930,16 +2787,15 @@

    Utility Functions

  • -
  • +
  • - +

    JavaScript micro-templating, similar to John Resig's implementation. Underscore templating handles arbitrary delimiters, preserves whitespace, -and correctly escapes quotes within interpolated code. -

    +and correctly escapes quotes within interpolated code.

    @@ -2950,14 +2806,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    Combine delimiters into one regular expression via alternation. -

    +

    Combine delimiters into one regular expression via alternation.

    @@ -2970,14 +2825,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    Compile the template source, escaping string literals appropriately. -

    +

    Compile the template source, escaping string literals appropriately.

    @@ -3004,14 +2858,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    If a variable is not specified, place data values in local scope. -

    +

    If a variable is not specified, place data values in local scope.

    @@ -3036,14 +2889,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    Provide the compiled function source as a convenience for precompilation. -

    +

    Provide the compiled function source as a convenience for precompilation.

    @@ -3055,14 +2907,13 @@

    Utility Functions

  • -
  • +
  • - +
    -

    Add a "chain" function, which will delegate to the wrapper. -

    +

    Add a "chain" function, which will delegate to the wrapper.

    @@ -3073,11 +2924,11 @@

    Utility Functions

  • -
  • +
  • - +

    OOP

    @@ -3086,30 +2937,16 @@

    OOP

  • -
  • +
  • - +

    If Underscore is called as a function, it returns a wrapped object that can be used OO-style. This wrapper holds altered versions of all the -underscore functions. Wrapped objects may be chained. -

    - -
    - -
  • - - -
  • -
    - -
    - -
    -

    Helper function to continue chaining intermediate results. -

    +underscore functions. Wrapped objects may be chained.

    +

    Helper function to continue chaining intermediate results.

    @@ -3120,14 +2957,13 @@

    OOP

  • -
  • +
  • - +
    -

    Add all of the Underscore functions to the wrapper object. -

    +

    Add all of the Underscore functions to the wrapper object.

    @@ -3136,14 +2972,13 @@

    OOP

  • -
  • +
  • - +
    -

    Add all mutator Array functions to the wrapper. -

    +

    Add all mutator Array functions to the wrapper.

    @@ -3160,14 +2995,13 @@

    OOP

  • -
  • +
  • - +
    -

    Add all accessor Array functions to the wrapper. -

    +

    Add all accessor Array functions to the wrapper.

    @@ -3183,14 +3017,13 @@

    OOP

  • -
  • +
  • - +
    -

    Start chaining a wrapped Underscore object. -

    +

    Start chaining a wrapped Underscore object.

    @@ -3202,14 +3035,13 @@

    OOP

  • -
  • +
  • - +
    -

    Extracts the result from a wrapped and chained object. -

    +

    Extracts the result from a wrapped and chained object.

    diff --git a/index.html b/index.html index 56d25b568..eddf69f38 100644 --- a/index.html +++ b/index.html @@ -181,7 +181,7 @@