diff --git a/docs/underscore.html b/docs/underscore.html index c9fd74974..976d4d062 100644 --- a/docs/underscore.html +++ b/docs/underscore.html @@ -1042,9 +1042,27 @@

Collection Functions

}; + + +
  • +
    + +
    + +
    +

    Trim out all falsy values from an object.

    + +
    + +
      _.compact = function(obj) {
    +    return _.filter(obj, _.identity);
    +  };
    + +
  • + -
  • +
  • @@ -1057,7 +1075,7 @@

    Array Functions

  • -
  • +
  • @@ -1069,7 +1087,7 @@

    Array Functions

  • -
  • +
  • @@ -1090,7 +1108,7 @@

    Array Functions

  • -
  • +
  • @@ -1109,7 +1127,7 @@

    Array Functions

  • -
  • +
  • @@ -1129,7 +1147,7 @@

    Array Functions

  • -
  • +
  • @@ -1145,24 +1163,7 @@

    Array Functions

    return slice.call(array, n == null || guard ? 1 : n); };
    -
  • - - -
  • -
    - -
    - -
    -

    Trim out all falsy values from an array.

    - -
    - -
      _.compact = function(array) {
    -    return _.filter(array, _.identity);
    -  };
    - -
  • +
  • diff --git a/index.html b/index.html index 2ae8a1f17..173ca6fdc 100644 --- a/index.html +++ b/index.html @@ -228,6 +228,7 @@
  • - toArray
  • - size
  • - partition
  • +
  • - compact
  • @@ -239,8 +240,7 @@
  • - first
  • - initial
  • - last
  • -
  • - rest
  • -
  • - compact
  • +
  • - rest
  • - flatten
  • - without
  • - union
  • @@ -851,6 +851,18 @@

    Collection Functions (Arrays or Objects)

     _.partition([0, 1, 2, 3, 4, 5], isOdd);
     => [[1, 3, 5], [0, 2, 4]]
    +
    + +

    + compact_.compact(list) +
    + Returns a copy of the list with all falsy values removed. + In JavaScript, false, null, 0, "", + undefined and NaN are all falsy. +

    +
    +_.compact([0, 1, false, 2, '', 3]);
    +=> [1, 2, 3]
     

    Array Functions

    @@ -907,18 +919,6 @@

    Array Functions

     _.rest([5, 4, 3, 2, 1]);
     => [4, 3, 2, 1]
    -
    - -

    - compact_.compact(array) -
    - Returns a copy of the array with all falsy values removed. - In JavaScript, false, null, 0, "", - undefined and NaN are all falsy. -

    -
    -_.compact([0, 1, false, 2, '', 3]);
    -=> [1, 2, 3]